﻿using System.Windows.Forms;
using System;
using System.Text;
using System.IO;
using System.Data;
using System.Data.SqlClient;

namespace ACRE
{
    public partial class Form1 : Form
    {
        static System.ComponentModel.BindingList<aniinfo> blaniinfo = new System.ComponentModel.BindingList<aniinfo>();
        static System.ComponentModel.BindingList<cob> blcob = new System.ComponentModel.BindingList<cob>();
        static System.ComponentModel.BindingList<StringResource> blStringResource = new System.ComponentModel.BindingList<StringResource>();
        static System.ComponentModel.BindingList<FieldPropResource> blFieldPropResource = new System.ComponentModel.BindingList<FieldPropResource>();
        static System.ComponentModel.BindingList<DropGroupResource> blDropGroupResource = new System.ComponentModel.BindingList<DropGroupResource>();
        static System.ComponentModel.BindingList<ItemResource> blItemResource = new System.ComponentModel.BindingList<ItemResource>();
        static System.ComponentModel.BindingList<SummonResource> blSummonResource = new System.ComponentModel.BindingList<SummonResource>();
        static System.ComponentModel.BindingList<SummonResource_82> blSummonResource_82 = new System.ComponentModel.BindingList<SummonResource_82>();
        static System.ComponentModel.BindingList<MonsterMotionSet> blMonsterMotionSet = new System.ComponentModel.BindingList<MonsterMotionSet>();
        static System.ComponentModel.BindingList<EffectResource> blEffectResource = new System.ComponentModel.BindingList<EffectResource>();
        static System.ComponentModel.BindingList<ModelEffectResource> blModelEffectResource = new System.ComponentModel.BindingList<ModelEffectResource>();
        static System.ComponentModel.BindingList<SkillResource> blSkillResource = new System.ComponentModel.BindingList<SkillResource>();
        static System.ComponentModel.BindingList<SkillResource_73> blSkillResource73 = new System.ComponentModel.BindingList<SkillResource_73>();
        static System.ComponentModel.BindingList<SkillTreeDisplay> blSkillTreeDisplay = new System.ComponentModel.BindingList<SkillTreeDisplay>();
        static System.ComponentModel.BindingList<SkillTreeResource> blSkillTreeResource = new System.ComponentModel.BindingList<SkillTreeResource>();
        static System.ComponentModel.BindingList<SkillTreeResource_82> blSkillTreeResource_82 = new System.ComponentModel.BindingList<SkillTreeResource_82>();
        static System.ComponentModel.BindingList<SkillStage> blSkillStage = new System.ComponentModel.BindingList<SkillStage>();
        static System.ComponentModel.BindingList<StateResource> blStateResource = new System.ComponentModel.BindingList<StateResource>();
        static System.ComponentModel.BindingList<ItemEffectResource> blItemEffectResource = new System.ComponentModel.BindingList<ItemEffectResource>();
        static System.ComponentModel.BindingList<MonsterResource> blMonsterResource = new System.ComponentModel.BindingList<MonsterResource>();
        static System.ComponentModel.BindingList<MonsterResource_82> blMonsterResource_82 = new System.ComponentModel.BindingList<MonsterResource_82>();
        static System.ComponentModel.BindingList<StatResource> blStatResource = new System.ComponentModel.BindingList<StatResource>();
        static System.ComponentModel.BindingList<JobResource> blJobResource = new System.ComponentModel.BindingList<JobResource>();
        static System.ComponentModel.BindingList<MixResource> blMixResource = new System.ComponentModel.BindingList<MixResource>();
        static System.ComponentModel.BindingList<NPCResource> blNPCResource = new System.ComponentModel.BindingList<NPCResource>();
        static System.ComponentModel.BindingList<QuestResource> blQuestResource = new System.ComponentModel.BindingList<QuestResource>();
        static System.ComponentModel.BindingList<QuestResource_73> blQuestResource73 = new System.ComponentModel.BindingList<QuestResource_73>();
        static System.ComponentModel.BindingList<QuestLinkResource> blQuestLinkResource = new System.ComponentModel.BindingList<QuestLinkResource>();
        static System.ComponentModel.BindingList<PetResource> blPetResource = new System.ComponentModel.BindingList<PetResource>();
        static System.ComponentModel.BindingList<PetResource_73> blPetResource73 = new System.ComponentModel.BindingList<PetResource_73>();
        static System.ComponentModel.BindingList<PetResource_82> blPetResource_82 = new System.ComponentModel.BindingList<PetResource_82>();
        static System.ComponentModel.BindingList<TitleResource> blTitleResource = new System.ComponentModel.BindingList<TitleResource>();
        static System.ComponentModel.BindingList<WorldLocation> blWorldLocation = new System.ComponentModel.BindingList<WorldLocation>();
        static System.ComponentModel.BindingList<WorldLocation_73> blWorldLocation73 = new System.ComponentModel.BindingList<WorldLocation_73>();

        enum Month
        {
            January = 1,
            Feburary = 2,
            March = 3,
            April = 4,
            May = 5,
            June = 6,
            July = 7,
            August = 8,
            September = 9,
            October = 10,
            November = 11,
            December = 12,
        }

        private void Open_RDB_Worker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            this.Invoke(new MethodInvoker(delegate { blaniinfo.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blcob.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blDropGroupResource.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blStringResource.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blFieldPropResource.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blItemResource.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blSummonResource.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blSummonResource_82.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blMonsterMotionSet.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blEffectResource.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blModelEffectResource.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blSkillResource.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blSkillResource73.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blSkillTreeDisplay.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blSkillTreeResource.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blSkillTreeResource_82.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blSkillStage.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blStateResource.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blItemEffectResource.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blMonsterResource.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blMonsterResource_82.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blStatResource.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blJobResource.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blMixResource.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blNPCResource.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blQuestResource.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blQuestResource73.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blQuestLinkResource.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blPetResource.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blPetResource73.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blPetResource_82.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blTitleResource.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blWorldLocation73.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blWorldLocation.Clear(); }));

            

            try
            {
                using (BinaryReader br = new BinaryReader(File.OpenRead(openFileDialog1.FileName), Encoding.ASCII))
                {

                    string selected_encode = "";
                    this.Invoke(new MethodInvoker(delegate { selected_encode = cbEncode.Text; }));

                    string selected_rdb = "";
                    this.Invoke(new MethodInvoker(delegate { selected_rdb = cbSelect.Text; }));

                    if (selected_rdb.ToString() == "Cob")
                    {
                        this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blcob; }));
                        while (br.PeekChar() != -1)
                        {
                            cob cob = new cob();
                            cob.ReadFile(br);
                            this.Invoke(new MethodInvoker(delegate { blcob.Add(cob); }));
                            this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                        }
                    }

                    String f_Date = ASCIIEncoding.ASCII.GetString(br.ReadBytes(8));
                    this.Invoke(new MethodInvoker(delegate { date_lab.Text = "Date Created: " + Enum.GetValues(typeof(Month)).GetValue(Convert.ToInt32(f_Date.Substring(4, 2)) - 1) + " " + f_Date.Substring(6, 2) + ", " + f_Date.Substring(0, 4); }));
                    this.Invoke(new MethodInvoker(delegate { date_lab.Location = new System.Drawing.Point(this.Width - date_lab.Width - 28, 9); }));
                    br.ReadBytes(120);
                    Int32 f_Rows = br.ReadInt32();
                    this.Invoke(new MethodInvoker(delegate { progressBar1.Value = 0; }));
                    this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = f_Rows; }));


                    switch (selected_rdb)
                    {
                        case "AnimationResource":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blaniinfo; }));
                            while (br.PeekChar() != -1)
                            {
                                aniinfo aniInfo = new aniinfo();
                                aniInfo.ReadFile(br);
                                this.Invoke(new MethodInvoker(delegate { blaniinfo.Add(aniInfo); }));
                                this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                            }
                            break;

                        case "DropGroupResource":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blDropGroupResource; }));
                            while (br.PeekChar() != -1)
                            {
                                DropGroupResource dropInfo = new DropGroupResource();
                                dropInfo.ReadFile(br);
                                this.Invoke(new MethodInvoker(delegate { blDropGroupResource.Add(dropInfo); }));
                                this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                            }
                            break;

                        case "EffectResource":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blEffectResource; }));
                            while (br.PeekChar() != -1)
                            {
                                EffectResource effectRes = new EffectResource();
                                effectRes.ReadFile(br);
                                this.Invoke(new MethodInvoker(delegate { blEffectResource.Add(effectRes); }));
                                this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                            }
                            break;

                        case "FieldPropResource":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blFieldPropResource; }));
                            while (br.PeekChar() != -1)
                            {
                                FieldPropResource fieldpropRes = new FieldPropResource();
                                fieldpropRes.ReadFile(br);
                                this.Invoke(new MethodInvoker(delegate { blFieldPropResource.Add(fieldpropRes); }));
                                this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                            }
                            break;

                        case "ItemEffectResource":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blItemEffectResource; }));
                            while (br.PeekChar() != -1)
                            {
                                ItemEffectResource itemeffectRes = new ItemEffectResource();
                                itemeffectRes.ReadFile(br);
                                this.Invoke(new MethodInvoker(delegate { blItemEffectResource.Add(itemeffectRes); }));
                                this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                            }
                            break;

                        case "ItemResource":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blItemResource; }));
                            while (br.PeekChar() != -1)
                            {
                                ItemResource itemRes = new ItemResource();
                                itemRes.ReadFile(br);
                                this.Invoke(new MethodInvoker(delegate { blItemResource.Add(itemRes); }));
                                this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                            }
                            break;

                        case "JobResource":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blJobResource; }));
                            while (br.PeekChar() != -1)
                            {
                                JobResource jobRes = new JobResource();
                                jobRes.ReadFile(br);
                                this.Invoke(new MethodInvoker(delegate { blJobResource.Add(jobRes); }));
                                this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                            }
                            break;

                        case "MixResource":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blMixResource; }));
                            while (br.PeekChar() != -1)
                            {
                                MixResource mixRes = new MixResource();
                                mixRes.ReadFile(br);
                                this.Invoke(new MethodInvoker(delegate { blMixResource.Add(mixRes); }));
                                this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                            }
                            break;

                        case "ModelEffectResource":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blModelEffectResource; }));
                            while (br.PeekChar() != -1)
                            {
                                ModelEffectResource modeleffectRes = new ModelEffectResource();
                                modeleffectRes.ReadFile(br);
                                this.Invoke(new MethodInvoker(delegate { blModelEffectResource.Add(modeleffectRes); }));
                                this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                            }
                            break;

                        case "MonsterMotionSet":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blMonsterMotionSet; }));
                            while (br.PeekChar() != -1)
                            {
                                MonsterMotionSet motionRes = new MonsterMotionSet();
                                motionRes.ReadFile(br);
                                this.Invoke(new MethodInvoker(delegate { blMonsterMotionSet.Add(motionRes); }));
                                this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                            }
                            break;

                        case "MonsterResource":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blMonsterResource; }));
                            while (br.PeekChar() != -1)
                            {
                                MonsterResource mobRes = new MonsterResource();
                                mobRes.ReadFile(br);
                                this.Invoke(new MethodInvoker(delegate { blMonsterResource.Add(mobRes); }));
                                this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                            }
                            break;

                        case "MonsterResource_82":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blMonsterResource_82; }));
                            while (br.PeekChar() != -1)
                            {
                                MonsterResource_82 mobRes82 = new MonsterResource_82();
                                mobRes82.ReadFile(br);
                                this.Invoke(new MethodInvoker(delegate { blMonsterResource_82.Add(mobRes82); }));
                                this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                            }
                            break;

                        case "NPCResource":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blNPCResource; }));
                            while (br.PeekChar() != -1)
                            {
                                NPCResource npcRes = new NPCResource();
                                npcRes.ReadFile(br);
                                this.Invoke(new MethodInvoker(delegate { blNPCResource.Add(npcRes); }));
                                this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                            }
                            break;

                        case "PetResource":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blPetResource; }));
                            while (br.PeekChar() != -1)
                            {
                                PetResource petRes = new PetResource();
                                petRes.ReadFile(br);
                                this.Invoke(new MethodInvoker(delegate { blPetResource.Add(petRes); }));
                                this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                            }
                            break;

                        case "PetResource_73":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blPetResource73; }));
                            while (br.PeekChar() != -1)
                            {
                                PetResource_73 petRes73 = new PetResource_73();
                                petRes73.ReadFile(br);
                                this.Invoke(new MethodInvoker(delegate { blPetResource73.Add(petRes73); }));
                                this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                            }
                            break;

                        case "PetResource_82":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blPetResource_82; }));
                            while (br.PeekChar() != -1)
                            {
                                PetResource_82 petRes82 = new PetResource_82();
                                petRes82.ReadFile(br);
                                this.Invoke(new MethodInvoker(delegate { blPetResource_82.Add(petRes82); }));
                                this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                            }
                            break;

                        case "QuestLinkResource":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blQuestLinkResource; }));
                            while (br.PeekChar() != -1)
                            {
                                QuestLinkResource linkRes = new QuestLinkResource();
                                linkRes.ReadFile(br);
                                this.Invoke(new MethodInvoker(delegate { blQuestLinkResource.Add(linkRes); }));
                                this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                            }
                            break;

                        case "QuestResource":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blQuestResource; }));
                            while (br.PeekChar() != -1)
                            {
                                QuestResource questRes = new QuestResource();
                                questRes.ReadFile(br);
                                this.Invoke(new MethodInvoker(delegate { blQuestResource.Add(questRes); }));
                                this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                            }
                            break;

                        case "QuestResource_73":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blQuestResource73; }));
                            while (br.PeekChar() != -1)
                            {
                                QuestResource_73 questRes73 = new QuestResource_73();
                                questRes73.ReadFile(br);
                                this.Invoke(new MethodInvoker(delegate { blQuestResource73.Add(questRes73); }));
                                this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                            }
                            break;

                        case "SkillResource":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blSkillResource; }));
                            while (br.PeekChar() != -1)
                            {
                                SkillResource skillRes = new SkillResource();
                                skillRes.ReadFile(br);
                                this.Invoke(new MethodInvoker(delegate { blSkillResource.Add(skillRes); }));
                                this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                            }
                            break;

                        case "SkillResource_73":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blSkillResource73; }));
                            while (br.PeekChar() != -1)
                            {
                                SkillResource_73 skillRes73 = new SkillResource_73();
                                skillRes73.ReadFile(br);
                                this.Invoke(new MethodInvoker(delegate { blSkillResource73.Add(skillRes73); }));
                                this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                            }
                            break;

                        case "SkillStage":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blSkillStage; }));
                            while (br.PeekChar() != -1)
                            {
                                SkillStage skillstageRes = new SkillStage();
                                skillstageRes.ReadFile(br);
                                this.Invoke(new MethodInvoker(delegate { blSkillStage.Add(skillstageRes); }));
                                this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                            }
                            break;

                        case "SkillTreeDisplay":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blSkillTreeDisplay; }));
                            while (br.PeekChar() != -1)
                            {
                                SkillTreeDisplay skilltreedisplayRes = new SkillTreeDisplay();
                                skilltreedisplayRes.ReadFile(br);
                                this.Invoke(new MethodInvoker(delegate { blSkillTreeDisplay.Add(skilltreedisplayRes); }));
                                this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                            }
                            break;

                        case "SkillTreeResource":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blSkillTreeResource; }));
                            int num1 = 0;
                            int num2 = 0;
                            while (br.PeekChar() != -1)
                            {
                                if (num2 == num1)
                                {
                                    num2 = 0;
                                    num1 = br.ReadInt32();
                                }
                                SkillTreeResource skilltreeRes = new SkillTreeResource();
                                skilltreeRes.ReadFile(br);
                                this.Invoke(new MethodInvoker(delegate { blSkillTreeResource.Add(skilltreeRes); }));
                                this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                                num2++;
                            }
                            break;

                        case "SkillTreeResource_82":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blSkillTreeResource_82; }));
                            int num11 = 0;
                            int num22 = 0;
                            while (br.PeekChar() != -1)
                            {
                                if (num22 == num11)
                                {
                                    num22 = 0;
                                    num11 = br.ReadInt32();
                                }
                                SkillTreeResource_82 skilltreeRes82 = new SkillTreeResource_82();
                                skilltreeRes82.ReadFile(br);
                                this.Invoke(new MethodInvoker(delegate { blSkillTreeResource_82.Add(skilltreeRes82); }));
                                this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                                num22++;
                            }
                            break;

                        case "StateResource":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blStateResource; }));
                            while (br.PeekChar() != -1)
                            {
                                StateResource stateRes = new StateResource();
                                stateRes.ReadFile(br);
                                this.Invoke(new MethodInvoker(delegate { blStateResource.Add(stateRes); }));
                                this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                            }
                            break;

                        case "StatResource":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blStatResource; }));
                            while (br.PeekChar() != -1)
                            {
                                StatResource statRes = new StatResource();
                                statRes.ReadFile(br);
                                this.Invoke(new MethodInvoker(delegate { blStatResource.Add(statRes); }));
                                this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                            }
                            break;

                        case "StringResource":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blStringResource; }));
                            while (br.PeekChar() != -1)
                            {
                                StringResource stringRes = new StringResource();
                                stringRes.ReadFile(br, selected_encode);
                                this.Invoke(new MethodInvoker(delegate { blStringResource.Add(stringRes); }));
                                this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                            }
                            break;

                        case "SummonResource":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blSummonResource; }));
                            while (br.PeekChar() != -1)
                            {
                                SummonResource summonRes = new SummonResource();
                                summonRes.ReadFile(br);
                                this.Invoke(new MethodInvoker(delegate { blSummonResource.Add(summonRes); }));
                                this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                            }
                            break;

                        case "SummonResource_82":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blSummonResource_82; }));
                            while (br.PeekChar() != -1)
                            {
                                SummonResource_82 summonRes82 = new SummonResource_82();
                                summonRes82.ReadFile(br);
                                this.Invoke(new MethodInvoker(delegate { blSummonResource_82.Add(summonRes82); }));
                                this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                            }
                            break;

                        case "TitleResource":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blTitleResource; }));
                            while (br.PeekChar() != -1)
                            {
                                TitleResource titleRes = new TitleResource();
                                titleRes.ReadFile(br);
                                this.Invoke(new MethodInvoker(delegate { blTitleResource.Add(titleRes); }));
                                this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                            }
                            break;

                        case "WorldLocation_73":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blWorldLocation73; }));
                            while (br.PeekChar() != -1)
                            {
                                WorldLocation_73 worldRes73 = new WorldLocation_73();
                                worldRes73.ReadFile(br);
                                this.Invoke(new MethodInvoker(delegate { blWorldLocation73.Add(worldRes73); }));
                                this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                            }
                            break;
                        
                        case "WorldLocation":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blWorldLocation; }));
                            while (br.PeekChar() != -1)
                            {
                                WorldLocation worldRes = new WorldLocation();
                                worldRes.ReadFile(br);
                                this.Invoke(new MethodInvoker(delegate { blWorldLocation.Add(worldRes); }));
                                this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                            }
                            break;
                    }
                    br.Close();
                    br.Dispose();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }

        private void Save_RDB_Worker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            try
            {
                using (BinaryWriter bw = new BinaryWriter(File.Create(saveFileDialog1.FileName)))
                {

                    bw.Write(SFM.GetFileHeader());
                    this.Invoke(new MethodInvoker(delegate { progressBar1.Value = 0; }));

                    string selected_encode = "";
                    this.Invoke(new MethodInvoker(delegate { selected_encode = cbEncode.Text; }));

                    string selected_rdb = "";
                    this.Invoke(new MethodInvoker(delegate { selected_rdb = cbSelect.Text; }));

                    switch (selected_rdb)
                    {
                        case "EffectResource":
                            bw.Write(blEffectResource.Count);
                            this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = blEffectResource.Count; }));

                            foreach (EffectResource effectRes in blEffectResource)
                            {
                                effectRes.SaveFile(bw);
                                this.Invoke(new MethodInvoker(delegate { progressBar1.Value++; }));
                            }
                            break;

                        case "FieldPropResource":
                            bw.Write(blFieldPropResource.Count);
                            this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = blFieldPropResource.Count; }));

                            foreach (FieldPropResource fieldpropRes in blFieldPropResource)
                            {
                                fieldpropRes.SaveFile(bw);
                                this.Invoke(new MethodInvoker(delegate { progressBar1.Value++; }));
                            }
                            break;

                        case "ItemEffectResource":
                            bw.Write(blItemEffectResource.Count);
                            this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = blItemEffectResource.Count; }));
                            foreach (ItemEffectResource itemeffectRes in blItemEffectResource)
                            {
                                itemeffectRes.SaveFile(bw);
                                this.Invoke(new MethodInvoker(delegate { progressBar1.Value++; }));
                            }
                            break;

                        case "ItemResource":
                            bw.Write(blItemResource.Count);
                            this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = blItemResource.Count; }));

                            foreach (ItemResource itemRes in blItemResource)
                            {
                                itemRes.SaveFile(bw);
                                this.Invoke(new MethodInvoker(delegate { progressBar1.Value++; }));
                            }
                            break;

                        case "JobResource":
                            bw.Write(blJobResource.Count);
                            this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = blJobResource.Count; }));
                            foreach (JobResource jobRes in blJobResource)
                            {
                                jobRes.SaveFile(bw);
                                this.Invoke(new MethodInvoker(delegate { progressBar1.Value++; }));
                            }
                            break;

                        case "MixResource":
                            bw.Write(blMixResource.Count);
                            this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = blMixResource.Count; }));
                            foreach (MixResource mixRes in blMixResource)
                            {
                                mixRes.SaveFile(bw);
                                this.Invoke(new MethodInvoker(delegate { progressBar1.Value++; }));
                            }
                            break;

                        case "ModelEffectResource":
                            bw.Write(blModelEffectResource.Count);
                            this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = blModelEffectResource.Count; }));

                            foreach (ModelEffectResource modeleffectRes in blModelEffectResource)
                            {
                                modeleffectRes.SaveFile(bw);
                                this.Invoke(new MethodInvoker(delegate { progressBar1.Value++; }));
                            }
                            break;

                        case "MonsterMotionSet":
                            bw.Write(blMonsterMotionSet.Count);
                            this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = blMonsterMotionSet.Count; }));

                            foreach (MonsterMotionSet motionRes in blMonsterMotionSet)
                            {
                                motionRes.SaveFile(bw);
                                this.Invoke(new MethodInvoker(delegate { progressBar1.Value++; }));
                            }
                            break;

                        case "MonsterResource":
                            bw.Write(blMonsterResource.Count);
                            this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = blMonsterResource.Count; }));
                            foreach (MonsterResource mobRes in blMonsterResource)
                            {
                                mobRes.SaveFile(bw);
                                this.Invoke(new MethodInvoker(delegate { progressBar1.Value++; }));
                            }
                            break;

                        case "NPCResource":
                            bw.Write(blNPCResource.Count);
                            this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = blNPCResource.Count; }));
                            foreach (NPCResource npcRes in blNPCResource)
                            {
                                npcRes.SaveFile(bw);
                                this.Invoke(new MethodInvoker(delegate { progressBar1.Value++; }));
                            }
                            break;

                        case "PetResource":
                            bw.Write(blPetResource.Count);
                            this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = blPetResource.Count; }));
                            foreach (PetResource petRes in blPetResource)
                            {
                                petRes.SaveFile(bw);
                                this.Invoke(new MethodInvoker(delegate { progressBar1.Value++; }));
                            }
                            break;

                        case "PetResource_73":
                            bw.Write(blPetResource73.Count);
                            this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = blPetResource73.Count; }));
                            foreach (PetResource_73 petRes73 in blPetResource73)
                            {
                                petRes73.SaveFile(bw);
                                this.Invoke(new MethodInvoker(delegate { progressBar1.Value++; }));
                            }
                            break;

                        case "PetResource_82":
                            bw.Write(blPetResource_82.Count);
                            this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = blPetResource_82.Count; }));
                            foreach (PetResource_82 petRes82 in blPetResource_82)
                            {
                                petRes82.SaveFile(bw);
                                this.Invoke(new MethodInvoker(delegate { progressBar1.Value++; }));
                            }
                            break;

                        case "QuestLinkResource":
                            bw.Write(blQuestLinkResource.Count);
                            this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = blQuestLinkResource.Count; }));
                            foreach (QuestLinkResource linkRes in blQuestLinkResource)
                            {
                                linkRes.SaveFile(bw);
                                this.Invoke(new MethodInvoker(delegate { progressBar1.Value++; }));
                            }
                            break;

                        case "QuestResource":
                            bw.Write(blQuestResource.Count);
                            this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = blQuestResource.Count; }));

                            foreach (QuestResource questRes in blQuestResource)
                            {
                                questRes.SaveFile(bw);
                                this.Invoke(new MethodInvoker(delegate { progressBar1.Value++; }));
                            }
                            break;

                        case "QuestResource_73":
                            bw.Write(blQuestResource73.Count);
                            this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = blQuestResource73.Count; }));

                            foreach (QuestResource_73 questRes73 in blQuestResource73)
                            {
                                questRes73.SaveFile(bw);
                                this.Invoke(new MethodInvoker(delegate { progressBar1.Value++; }));
                            }
                            break;

                        case "SkillResource":
                            bw.Write(blSkillResource.Count);
                            this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = blSkillResource.Count; }));

                            foreach (SkillResource skillRes in blSkillResource)
                            {
                                skillRes.SaveFile(bw);
                                this.Invoke(new MethodInvoker(delegate { progressBar1.Value++; }));
                            }
                            break;

                        case "SkillResource_73":
                            bw.Write(blSkillResource73.Count);
                            this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = blSkillResource73.Count; }));

                            
                                foreach (SkillResource_73 skillRes73 in blSkillResource73)
                                {

                                    skillRes73.SaveFile(bw);
                                    this.Invoke(new MethodInvoker(delegate { progressBar1.Value++; }));
                                    }
                                break;
                            

                        case "SkillStage":
                            bw.Write(blSkillStage.Count);
                            this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = blSkillStage.Count; }));
                            foreach (SkillStage skillstageRes in blSkillStage)
                            {
                                skillstageRes.SaveFile(bw);
                                this.Invoke(new MethodInvoker(delegate { progressBar1.Value++; }));
                            }
                            break;

                        case "SkillTreeDisplay":
                            bw.Write(blSkillTreeDisplay.Count);
                            this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = blSkillTreeDisplay.Count; }));

                            foreach (SkillTreeDisplay skilltreedisplayRes in blSkillTreeDisplay)
                            {
                                skilltreedisplayRes.SaveFile(bw);
                                this.Invoke(new MethodInvoker(delegate { progressBar1.Value++; }));
                            }
                            break;

                        case "SkillTreeResource":
                            this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = blSkillTreeResource.Count; }));
                            int num1 = 0;
                            Int32 num2 = 0;
                            Int32 _number = 0;
                            foreach (SkillTreeResource skilltreeRes in blSkillTreeResource)
                            {
                                int num3 = skilltreeRes.job_id;
                                if (num1 != num3)
                                {
                                    num1 = num3;
                                    num2++;
                                }
                            }
                            bw.Write(num2);
                            num1 = 0;
                            foreach (SkillTreeResource skilltreeRes in blSkillTreeResource)
                            {
                                Int32 num4 = skilltreeRes.job_id;
                                if (num1 != num4)
                                {
                                    _number = skilltreeRes.get_number(num4, blSkillTreeResource.Count, blSkillTreeResource);
                                    num1 = num4;
                                    bw.Write(_number);
                                }
                                bw.Write(num4);
                                skilltreeRes.SaveFile(bw);
                                this.Invoke(new MethodInvoker(delegate { progressBar1.Value++; }));
                            }
                            break;

                        case "SkillTreeResource_82":
                            this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = blSkillTreeResource_82.Count; }));
                            int num11 = 0;
                            Int32 num22 = 0;
                            Int32 _number_ = 0;
                            foreach (SkillTreeResource_82 skilltreeRes82 in blSkillTreeResource_82)
                            {
                                int num33 = skilltreeRes82.job_id;
                                if (num11 != num33)
                                {
                                    num11 = num33;
                                    num22++;
                                }
                            }

                            bw.Write(num22);
                            num11 = 0;
                            foreach (SkillTreeResource_82 skilltreeRes82 in blSkillTreeResource_82)
                            {
                                Int32 num44 = skilltreeRes82.job_id;
                                if (num11 != num44)
                                {
                                    _number_ = skilltreeRes82.get_number(num44, blSkillTreeResource_82.Count, blSkillTreeResource_82);

                                    num11 = num44;
                                    bw.Write(_number_);
                                }
                                bw.Write(num44);
                                skilltreeRes82.SaveFile(bw);
                                this.Invoke(new MethodInvoker(delegate { progressBar1.Value++; }));
                            }
                            break;

                        case "StateResource":
                            bw.Write(blStateResource.Count);
                            this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = blStateResource.Count; }));
                            foreach (StateResource stateRes in blStateResource)
                            {
                                stateRes.SaveFile(bw);
                                this.Invoke(new MethodInvoker(delegate { progressBar1.Value++; }));
                            }
                            break;

                        case "StatResource":
                            bw.Write(blStatResource.Count);
                            this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = blStatResource.Count; }));
                            foreach (StatResource statRes in blStatResource)
                            {
                                statRes.SaveFile(bw);
                                this.Invoke(new MethodInvoker(delegate { progressBar1.Value++; }));
                            }
                            break;

                        case "StringResource":
                            bw.Write(blStringResource.Count);
                            this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = blStringResource.Count; }));

                            foreach (StringResource stringRes in blStringResource)
                            {
                                stringRes.SaveFile(bw, selected_encode);
                                this.Invoke(new MethodInvoker(delegate { progressBar1.Value++; }));
                            }
                            break;

                        case "SummonResource":
                            bw.Write(blSummonResource.Count);
                            this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = blSummonResource.Count; }));

                            foreach (SummonResource summonRes in blSummonResource)
                            {
                                summonRes.SaveFile(bw);
                                this.Invoke(new MethodInvoker(delegate { progressBar1.Value++; }));
                            }
                            break;

                        case "SummonResource_82":
                            bw.Write(blSummonResource_82.Count);
                            this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = blSummonResource_82.Count; }));

                            foreach (SummonResource_82 summonRes82 in blSummonResource_82)
                            {
                                summonRes82.SaveFile(bw);
                                this.Invoke(new MethodInvoker(delegate { progressBar1.Value++; }));
                            }
                            break;

                        case "WorldLocation_73":
                            bw.Write(blWorldLocation73.Count);
                            this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = blWorldLocation73.Count; }));
                            foreach (WorldLocation_73 worldRes73 in blWorldLocation73)
                            {
                                worldRes73.SaveFile(bw);
                                this.Invoke(new MethodInvoker(delegate { progressBar1.Value++; }));
                            }
                            break;

                        case "WorldLocation":
                            bw.Write(blWorldLocation.Count);
                            this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = blWorldLocation.Count; }));
                            foreach (WorldLocation worldRes in blWorldLocation)
                            {
                                worldRes.SaveFile(bw);
                                this.Invoke(new MethodInvoker(delegate { progressBar1.Value++; }));
                            }
                            break;
                    }
                    bw.Close();
                    bw.Dispose();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }

        private void Import_RDB_DB_Worker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            try
            {
                string connect = string.Format("Data Source={0};Initial Catalog={1};User Id={2};Password={3};", OPT.GetString("db.server"), OPT.GetString("db.name"), OPT.GetString("db.account"), SFM.GetDecryptMD5(OPT.GetString("db.password")));
                using (SqlConnection sqlcon = new SqlConnection(connect))
                {
                    this.Invoke(new MethodInvoker(delegate { progressBar1.Value = 0; }));
                    string selected_rdb = "";
                    this.Invoke(new MethodInvoker(delegate { selected_rdb = cbSelect.Text; }));
                    sqlcon.Open();

                    switch (selected_rdb)
                    {
                        case "EffectResource":
                            this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = blEffectResource.Count; }));
                            new SqlCommand("TRUNCATE TABLE EffectResource", sqlcon).ExecuteNonQuery();
                            foreach (EffectResource effectRes in blEffectResource)
                            {
                                SqlCommand cmd = new SqlCommand(effectRes.ToDatabase(), sqlcon);
                                cmd.Parameters.Clear();
                                cmd.Parameters.Add("@Presource_effect_file_id", SqlDbType.Int).Value = effectRes.resource_effect_file_id;
                                cmd.Parameters.Add("@Presource_effect_file_name", SqlDbType.VarChar).Value = effectRes.resource_effect_file_name;
                                cmd.ExecuteNonQuery();
                                cmd.Dispose();
                                this.Invoke(new MethodInvoker(delegate { progressBar1.Value++; }));
                            }
                            break;

                        case "NPCResource":
                            this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = blNPCResource.Count; }));
                            new SqlCommand("TRUNCATE TABLE NPCREsource", sqlcon).ExecuteNonQuery();
                            foreach (NPCResource npcResource in blNPCResource)
                            {
                                SqlCommand cmd = new SqlCommand(npcResource.ToDatabase(), sqlcon);
                                cmd.Parameters.Clear();
                                cmd.Parameters.Add("@id", SqlDbType.Int).Value = npcResource.id;
                                cmd.Parameters.Add("@text_id", SqlDbType.Int).Value = npcResource.text_id;
                                cmd.Parameters.Add("@name_text_id", SqlDbType.Int).Value = npcResource.name_text_id;
                                cmd.Parameters.Add("@race_id", SqlDbType.Int).Value = npcResource.race_id;
                                cmd.Parameters.Add("@sexsual_id", SqlDbType.Int).Value = npcResource.sexsual_id;
                                cmd.Parameters.Add("@x", SqlDbType.Int).Value = npcResource.x;
                                cmd.Parameters.Add("@y", SqlDbType.Int).Value = npcResource.y;
                                cmd.Parameters.Add("@z", SqlDbType.Int).Value = npcResource.z;
                                cmd.Parameters.Add("@face", SqlDbType.Int).Value = npcResource.face;
                                cmd.Parameters.Add("@local_flag", SqlDbType.Int).Value = npcResource.local_flag;
                                cmd.Parameters.Add("@is_periodic", SqlDbType.Int).Value = npcResource.is_periodic;
                                cmd.Parameters.Add("@begin_of_period", SqlDbType.DateTime).Value = npcResource.begin_of_period;
                                cmd.Parameters.Add("@end_of_period", SqlDbType.DateTime).Value = npcResource.end_of_period;
                                cmd.Parameters.Add("@face_x", SqlDbType.Int).Value = npcResource.face_x;
                                cmd.Parameters.Add("@face_y", SqlDbType.Int).Value = npcResource.face_y;
                                cmd.Parameters.Add("@face_z", SqlDbType.Int).Value = npcResource.face_z;
                                cmd.Parameters.Add("@model_file", SqlDbType.VarChar).Value = npcResource.model_file;
                                cmd.Parameters.Add("@hair_id", SqlDbType.Int).Value = npcResource.hair_id;
                                cmd.Parameters.Add("@face_id", SqlDbType.Int).Value = npcResource.face_id;
                                cmd.Parameters.Add("@body_id", SqlDbType.Int).Value = npcResource.body_id;
                                cmd.Parameters.Add("@weapon_item_id", SqlDbType.Int).Value = npcResource.weapon_item_id;
                                cmd.Parameters.Add("@shield_item_id", SqlDbType.Int).Value = npcResource.shield_item_id;
                                cmd.Parameters.Add("@clothes_item_id", SqlDbType.Int).Value = npcResource.clothes_item_id;
                                cmd.Parameters.Add("@helm_item_id", SqlDbType.Int).Value = npcResource.helm_item_id;
                                cmd.Parameters.Add("@gloves_item_id", SqlDbType.Int).Value = npcResource.gloves_item_id;
                                cmd.Parameters.Add("@boots_item_id", SqlDbType.Int).Value = npcResource.boots_item_id;
                                cmd.Parameters.Add("@belt_item_id", SqlDbType.Int).Value = npcResource.belt_item_id;
                                cmd.Parameters.Add("@mantle_item_id", SqlDbType.Int).Value = npcResource.mantle_item_id;
                                cmd.Parameters.Add("@necklace_item_id", SqlDbType.Int).Value = npcResource.necklace_item_id;
                                cmd.Parameters.Add("@earring_item_id", SqlDbType.Int).Value = npcResource.earring_item_id;
                                cmd.Parameters.Add("@ring1_item_id", SqlDbType.Int).Value = npcResource.ring1_item_id;
                                cmd.Parameters.Add("@ring2_item_id", SqlDbType.Int).Value = npcResource.ring2_item_id;
                                cmd.Parameters.Add("@motion_id", SqlDbType.Int).Value = npcResource.motion_id;
                                cmd.Parameters.Add("@is_roam", SqlDbType.Int).Value = npcResource.is_roam;
                                cmd.Parameters.Add("@roaming_id", SqlDbType.Int).Value = npcResource.roaming_id;
                                cmd.Parameters.Add("@standard_walk_speed", SqlDbType.Int).Value = npcResource.standard_walk_speed;
                                cmd.Parameters.Add("@standard_run_speed", SqlDbType.Int).Value = npcResource.standard_run_speed;
                                cmd.Parameters.Add("@walk_speed", SqlDbType.Int).Value = npcResource.walk_speed;
                                cmd.Parameters.Add("@run_speed", SqlDbType.Int).Value = npcResource.run_speed;
                                cmd.Parameters.Add("@attackable", SqlDbType.Int).Value = npcResource.attackable;
                                cmd.Parameters.Add("@offensive_type", SqlDbType.Int).Value = npcResource.offensive_type;
                                cmd.Parameters.Add("@spawn_type", SqlDbType.Int).Value = npcResource.spawn_type;
                                cmd.Parameters.Add("@chase_range", SqlDbType.Int).Value = npcResource.chase_range;
                                cmd.Parameters.Add("@regen_time", SqlDbType.Int).Value = npcResource.regen_time;
                                cmd.Parameters.Add("@level", SqlDbType.Int).Value = npcResource.level;
                                cmd.Parameters.Add("@stat_id", SqlDbType.Int).Value = npcResource.stat_id;
                                cmd.Parameters.Add("@attack_range", SqlDbType.Int).Value = npcResource.attack_range;
                                cmd.Parameters.Add("@attack_speed_type", SqlDbType.Int).Value = npcResource.attack_speed_type;
                                cmd.Parameters.Add("@hp", SqlDbType.Int).Value = npcResource.hp;
                                cmd.Parameters.Add("@mp", SqlDbType.Int).Value = npcResource.mp;
                                cmd.Parameters.Add("@attack_point", SqlDbType.Int).Value = npcResource.attack_point;
                                cmd.Parameters.Add("@magic_point", SqlDbType.Int).Value = npcResource.magic_point;
                                cmd.Parameters.Add("@defence", SqlDbType.Int).Value = npcResource.defence;
                                cmd.Parameters.Add("@magic_defence", SqlDbType.Int).Value = npcResource.magic_defence;
                                cmd.Parameters.Add("@attack_speed", SqlDbType.Int).Value = npcResource.attack_speed;
                                cmd.Parameters.Add("@magic_speed", SqlDbType.Int).Value = npcResource.magic_speed;
                                cmd.Parameters.Add("@accuracy", SqlDbType.Int).Value = npcResource.accuracy;
                                cmd.Parameters.Add("@avoid", SqlDbType.Int).Value = npcResource.avoid;
                                cmd.Parameters.Add("@magic_accuracy", SqlDbType.Int).Value = npcResource.magic_accuracy;
                                cmd.Parameters.Add("@magic_avoid", SqlDbType.Int).Value = npcResource.magic_avoid;
                                cmd.Parameters.Add("@ai_script", SqlDbType.VarChar).Value = npcResource.ai_script;
                                cmd.Parameters.Add("@contact_script", SqlDbType.VarChar).Value = npcResource.contact_script;
                                cmd.Parameters.Add("@texture_group", SqlDbType.Int).Value = npcResource.texture_group;
                                cmd.Parameters.Add("@type", SqlDbType.Int).Value = npcResource.type;
                                cmd.ExecuteNonQuery();
                                cmd.Dispose();
                                this.Invoke(new MethodInvoker(delegate { progressBar1.Value++; }));
                            }
                            break;

                        case "FieldPropResource":
                            this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = blFieldPropResource.Count; }));
                            new SqlCommand("TRUNCATE TABLE FieldPropResource", sqlcon).ExecuteNonQuery();
                            foreach (FieldPropResource fieldpropRes in blFieldPropResource)
                            {
                                SqlCommand cmd = new SqlCommand(fieldpropRes.ToDatabase(), sqlcon);
                                cmd.Parameters.Clear();
                                cmd.Parameters.Add("@Pid", SqlDbType.Int).Value = fieldpropRes.id;
                                cmd.Parameters.Add("@Ptext_id", SqlDbType.Int).Value = fieldpropRes.text_id;
                                cmd.Parameters.Add("@Ptooltip_id", SqlDbType.Int).Value = fieldpropRes.tooltip_id;
                                cmd.Parameters.Add("@Ptype", SqlDbType.Int).Value = fieldpropRes.type;
                                cmd.Parameters.Add("@Plocal_flag", SqlDbType.Int).Value = fieldpropRes.local_flag;
                                cmd.Parameters.Add("@Pcasting_time", SqlDbType.Int).Value = fieldpropRes.casting_time;
                                cmd.Parameters.Add("@Puse_count", SqlDbType.Int).Value = fieldpropRes.use_count;
                                cmd.Parameters.Add("@Pregen_time", SqlDbType.Int).Value = fieldpropRes.regen_time;
                                cmd.Parameters.Add("@Plife_time", SqlDbType.Int).Value = fieldpropRes.life_time;
                                cmd.Parameters.Add("@Pcasting_range", SqlDbType.Decimal).Value = fieldpropRes.casting_range;
                                cmd.Parameters.Add("@Ptarget_fx_size", SqlDbType.Decimal).Value = fieldpropRes.target_fx_size;
                                cmd.Parameters.Add("@Plimit_min_level", SqlDbType.Int).Value = fieldpropRes.limit_min_level;
                                cmd.Parameters.Add("@Plimit_max_level", SqlDbType.Int).Value = fieldpropRes.limit_max_level;
                                cmd.Parameters.Add("@Plimit_deva", SqlDbType.Char).Value = fieldpropRes.limit_deva;
                                cmd.Parameters.Add("@Plimit_asura", SqlDbType.Char).Value = fieldpropRes.limit_asura;
                                cmd.Parameters.Add("@Plimit_gaia", SqlDbType.Char).Value = fieldpropRes.limit_gaia;
                                cmd.Parameters.Add("@Plimit_fighter", SqlDbType.Char).Value = fieldpropRes.limit_fighter;
                                cmd.Parameters.Add("@Plimit_hunter", SqlDbType.Char).Value = fieldpropRes.limit_hunter;
                                cmd.Parameters.Add("@Plimit_magician", SqlDbType.Char).Value = fieldpropRes.limit_magician;
                                cmd.Parameters.Add("@Plimit_summoner", SqlDbType.Char).Value = fieldpropRes.limit_summoner;
                                cmd.Parameters.Add("@Plimit_job", SqlDbType.Int).Value = fieldpropRes.limit_job;
                                cmd.Parameters.Add("@Pactivation_condition", SqlDbType.Int).Value = fieldpropRes.activation_condition;
                                cmd.Parameters.Add("@Pactivation_value1", SqlDbType.Int).Value = fieldpropRes.activation_value1;
                                cmd.Parameters.Add("@Pactivation_value2", SqlDbType.Int).Value = fieldpropRes.activation_value2;
                                cmd.Parameters.Add("@Pactivation2_condition", SqlDbType.Int).Value = fieldpropRes.activation2_condition;
                                cmd.Parameters.Add("@Pactivation2_value1", SqlDbType.Int).Value = fieldpropRes.activation2_value1;
                                cmd.Parameters.Add("@Pactivation2_value2", SqlDbType.Int).Value = fieldpropRes.activation2_value2;
                                cmd.Parameters.Add("@Pactivate_id", SqlDbType.Int).Value = fieldpropRes.activate_id;
                                cmd.Parameters.Add("@Pdrop_item_id_00", SqlDbType.Int).Value = fieldpropRes.drop_item_id_00;
                                cmd.Parameters.Add("@Pdrop_item_ratio_00", SqlDbType.Int).Value = fieldpropRes.drop_item_ratio_00;
                                cmd.Parameters.Add("@Pdrop_item_count_min_00", SqlDbType.Int).Value = fieldpropRes.drop_item_count_min_00;
                                cmd.Parameters.Add("@Pdrop_item_count_max_00", SqlDbType.Int).Value = fieldpropRes.drop_item_count_max_00;
                                cmd.Parameters.Add("@Pdrop_item_level_min_00", SqlDbType.Int).Value = fieldpropRes.drop_item_level_min_00;
                                cmd.Parameters.Add("@Pdrop_item_level_max_00", SqlDbType.Int).Value = fieldpropRes.drop_item_level_max_00;
                                cmd.Parameters.Add("@Pdrop_item_id_01", SqlDbType.Int).Value = fieldpropRes.drop_item_id_01;
                                cmd.Parameters.Add("@Pdrop_item_ratio_01", SqlDbType.Int).Value = fieldpropRes.drop_item_ratio_01;
                                cmd.Parameters.Add("@Pdrop_item_count_min_01", SqlDbType.Int).Value = fieldpropRes.drop_item_count_min_01;
                                cmd.Parameters.Add("@Pdrop_item_count_max_01", SqlDbType.Int).Value = fieldpropRes.drop_item_count_max_01;
                                cmd.Parameters.Add("@Pdrop_item_level_min_01", SqlDbType.Int).Value = fieldpropRes.drop_item_level_min_01;
                                cmd.Parameters.Add("@Pdrop_item_level_max_01", SqlDbType.Int).Value = fieldpropRes.drop_item_level_max_01;
                                cmd.Parameters.Add("@Pscript_text", SqlDbType.VarChar).Value = fieldpropRes.script_text;
                                cmd.Parameters.Add("@Pfile_name", SqlDbType.VarChar).Value = fieldpropRes.file_name;
                                cmd.Parameters.Add("@Pterrain_check", SqlDbType.Char).Value = fieldpropRes.terrain_check;
                                cmd.Parameters.Add("@Pworldmap_check_type", SqlDbType.SmallInt).Value = fieldpropRes.worldmap_check_type;
                                cmd.ExecuteNonQuery();
                                cmd.Dispose();
                                this.Invoke(new MethodInvoker(delegate { progressBar1.Value++; }));
                            }
                            break;

                        case "ItemEffectResource":
                            this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = blItemEffectResource.Count; }));
                            new SqlCommand("TRUNCATE TABLE ItemEffectResource", sqlcon).ExecuteNonQuery();
                            foreach (ItemEffectResource itemeffectRes in blItemEffectResource)
                            {
                                SqlCommand cmd = new SqlCommand(itemeffectRes.ToDatabase(), sqlcon);
                                cmd.Parameters.Clear();
                                cmd.Parameters.Add("@Pid", SqlDbType.Int).Value = itemeffectRes.id;
                                cmd.Parameters.Add("@Pordinal_id", SqlDbType.Int).Value = itemeffectRes.ordinal_id;
                                cmd.Parameters.Add("@Ptooltip_id", SqlDbType.Int).Value = itemeffectRes.tooltip_id;
                                cmd.Parameters.Add("@Pmin_level", SqlDbType.Int).Value = 0;
                                cmd.Parameters.Add("@Pmax_level", SqlDbType.Int).Value = 0;
                                cmd.Parameters.Add("@Peffect_type", SqlDbType.TinyInt).Value = itemeffectRes.effect_type;
                                cmd.Parameters.Add("@Peffect_id", SqlDbType.SmallInt).Value = itemeffectRes.effect_id;
                                cmd.Parameters.Add("@Peffect_level", SqlDbType.SmallInt).Value = itemeffectRes.effect_level;
                                cmd.Parameters.Add("@Pvalue_0", SqlDbType.Decimal).Value = itemeffectRes.value_0;
                                cmd.Parameters.Add("@Pvalue_1", SqlDbType.Decimal).Value = itemeffectRes.value_1;
                                cmd.Parameters.Add("@Pvalue_2", SqlDbType.Decimal).Value = itemeffectRes.value_2;
                                cmd.Parameters.Add("@Pvalue_3", SqlDbType.Decimal).Value = itemeffectRes.value_3;
                                cmd.Parameters.Add("@Pvalue_4", SqlDbType.Decimal).Value = itemeffectRes.value_4;
                                cmd.Parameters.Add("@Pvalue_5", SqlDbType.Decimal).Value = itemeffectRes.value_5;
                                cmd.Parameters.Add("@Pvalue_6", SqlDbType.Decimal).Value = itemeffectRes.value_6;
                                cmd.Parameters.Add("@Pvalue_7", SqlDbType.Decimal).Value = itemeffectRes.value_7;
                                cmd.Parameters.Add("@Pvalue_8", SqlDbType.Decimal).Value = itemeffectRes.value_8;
                                cmd.Parameters.Add("@Pvalue_9", SqlDbType.Decimal).Value = itemeffectRes.value_9;
                                cmd.Parameters.Add("@Pvalue_10", SqlDbType.Decimal).Value = itemeffectRes.value_10;
                                cmd.Parameters.Add("@Pvalue_11", SqlDbType.Decimal).Value = itemeffectRes.value_11;
                                cmd.Parameters.Add("@Pvalue_12", SqlDbType.Decimal).Value = itemeffectRes.value_12;
                                cmd.Parameters.Add("@Pvalue_13", SqlDbType.Decimal).Value = itemeffectRes.value_13;
                                cmd.Parameters.Add("@Pvalue_14", SqlDbType.Decimal).Value = itemeffectRes.value_14;
                                cmd.Parameters.Add("@Pvalue_15", SqlDbType.Decimal).Value = itemeffectRes.value_15;
                                cmd.Parameters.Add("@Pvalue_16", SqlDbType.Decimal).Value = itemeffectRes.value_16;
                                cmd.Parameters.Add("@Pvalue_17", SqlDbType.Decimal).Value = itemeffectRes.value_17;
                                cmd.Parameters.Add("@Pvalue_18", SqlDbType.Decimal).Value = itemeffectRes.value_18;
                                cmd.Parameters.Add("@Pvalue_19", SqlDbType.Decimal).Value = itemeffectRes.value_19;
                                cmd.ExecuteNonQuery();
                                cmd.Dispose();
                                this.Invoke(new MethodInvoker(delegate { progressBar1.Value++; }));
                            }
                            break;

                        case "ItemResource":
                            this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = blItemResource.Count; }));
                            new SqlCommand("TRUNCATE TABLE ItemResource", sqlcon).ExecuteNonQuery();
                            foreach (ItemResource itemRes in blItemResource)
                            {
                                SqlCommand cmd = new SqlCommand(itemRes.ToDatabase(), sqlcon);
                                cmd.Parameters.Clear();
                                cmd.Parameters.Add("@Pid", SqlDbType.Int).Value = itemRes.id;
                                cmd.Parameters.Add("@Pname_id", SqlDbType.Int).Value = itemRes.name_id;
                                cmd.Parameters.Add("@Ptooltip_id", SqlDbType.Int).Value = itemRes.tooltip_id;
                                cmd.Parameters.Add("@Ptype", SqlDbType.Int).Value = itemRes.type;
                                cmd.Parameters.Add("@Pgroup", SqlDbType.Int).Value = itemRes.group;
                                cmd.Parameters.Add("@Pclass", SqlDbType.Int).Value = itemRes.Class;
                                cmd.Parameters.Add("@Pwear_type", SqlDbType.Int).Value = itemRes.wear_type;
                                cmd.Parameters.Add("@Pset_id", SqlDbType.Int).Value = itemRes.Set_id;
                                cmd.Parameters.Add("@Pset_part_flag", SqlDbType.Int).Value = itemRes.set_part_flag;
                                cmd.Parameters.Add("@Pgrade", SqlDbType.TinyInt).Value = itemRes.grade;
                                cmd.Parameters.Add("@Prank", SqlDbType.Int).Value = itemRes.rank;
                                cmd.Parameters.Add("@Plevel", SqlDbType.Int).Value = itemRes.level;
                                cmd.Parameters.Add("@Penhance", SqlDbType.Int).Value = itemRes.enhance;
                                cmd.Parameters.Add("@Psocket", SqlDbType.Int).Value = itemRes.socket;
                                cmd.Parameters.Add("@Pstatus_flag", SqlDbType.Int).Value = itemRes.status_flag;
                                cmd.Parameters.Add("@Plimit_deva", SqlDbType.Char).Value = itemRes.limit_deva;
                                cmd.Parameters.Add("@Plimit_asura", SqlDbType.Char).Value = itemRes.limit_asura;
                                cmd.Parameters.Add("@Plimit_gaia", SqlDbType.Char).Value = itemRes.limit_gaia;
                                cmd.Parameters.Add("@Pjob_depth", SqlDbType.TinyInt).Value = itemRes.job_depth;
                                cmd.Parameters.Add("@Plimit_fighter", SqlDbType.Char).Value = itemRes.limit_fighter;
                                cmd.Parameters.Add("@Plimit_hunter", SqlDbType.Char).Value = itemRes.limit_hunter;
                                cmd.Parameters.Add("@Plimit_magician", SqlDbType.Char).Value = itemRes.limit_magician;
                                cmd.Parameters.Add("@Plimit_summoner", SqlDbType.Char).Value = itemRes.limit_summoner;
                                cmd.Parameters.Add("@Puse_min_level", SqlDbType.Int).Value = itemRes.use_min_level;
                                cmd.Parameters.Add("@Puse_max_level", SqlDbType.Int).Value = itemRes.use_max_level;
                                cmd.Parameters.Add("@Ptarget_min_level", SqlDbType.Int).Value = itemRes.target_min_level;
                                cmd.Parameters.Add("@Ptarget_max_level", SqlDbType.Int).Value = itemRes.target_max_level;
                                cmd.Parameters.Add("@Prange", SqlDbType.Decimal).Value = itemRes.range;
                                cmd.Parameters.Add("@Pweight", SqlDbType.Decimal).Value = itemRes.weight;
                                cmd.Parameters.Add("@Pprice", SqlDbType.Int).Value = itemRes.price;
                                cmd.Parameters.Add("@Phuntaholic_point", SqlDbType.Int).Value = itemRes.huntaholic_point;
                                cmd.Parameters.Add("@Parena_point", SqlDbType.Int).Value = 0;
                                cmd.Parameters.Add("@Pethereal_durability", SqlDbType.Int).Value = itemRes.ethereal_durability;
                                cmd.Parameters.Add("@Pendurance", SqlDbType.Int).Value = itemRes.endurance;
                                cmd.Parameters.Add("@Pmaterial", SqlDbType.Int).Value = itemRes.material;
                                cmd.Parameters.Add("@Psummon_id", SqlDbType.Int).Value = itemRes.summon_id;
                                cmd.Parameters.Add("@Pitem_use_flag", SqlDbType.Int).Value = itemRes.item_use_flag;
                                cmd.Parameters.Add("@Pavailable_period", SqlDbType.Int).Value = itemRes.available_period;
                                cmd.Parameters.Add("@Pdecrease_type", SqlDbType.TinyInt).Value = itemRes.decrease_type;
                                cmd.Parameters.Add("@Pthrow_range", SqlDbType.Decimal).Value = itemRes.throw_range;
                                cmd.Parameters.Add("@Pbase_type_0", SqlDbType.SmallInt).Value = itemRes.base_type_0;
                                cmd.Parameters.Add("@Pbase_var1_0", SqlDbType.Decimal).Value = itemRes.base_var1_0;
                                cmd.Parameters.Add("@Pbase_var2_0", SqlDbType.Decimal).Value = itemRes.base_var2_0;
                                cmd.Parameters.Add("@Pbase_type_1", SqlDbType.SmallInt).Value = itemRes.base_type_1;
                                cmd.Parameters.Add("@Pbase_var1_1", SqlDbType.Decimal).Value = itemRes.base_var1_1;
                                cmd.Parameters.Add("@Pbase_var2_1", SqlDbType.Decimal).Value = itemRes.base_var2_1; ;
                                cmd.Parameters.Add("@Pbase_type_2", SqlDbType.SmallInt).Value = itemRes.base_type_2;
                                cmd.Parameters.Add("@Pbase_var1_2", SqlDbType.Decimal).Value = itemRes.base_var1_2;
                                cmd.Parameters.Add("@Pbase_var2_2", SqlDbType.Decimal).Value = itemRes.base_var2_2;
                                cmd.Parameters.Add("@Pbase_type_3", SqlDbType.SmallInt).Value = itemRes.base_type_3;
                                cmd.Parameters.Add("@Pbase_var1_3", SqlDbType.Decimal).Value = itemRes.base_var1_3;
                                cmd.Parameters.Add("@Pbase_var2_3", SqlDbType.Decimal).Value = itemRes.base_var2_3;
                                cmd.Parameters.Add("@Popt_type_0", SqlDbType.SmallInt).Value = itemRes.opt_type_0;
                                cmd.Parameters.Add("@Popt_var1_0", SqlDbType.Decimal).Value = itemRes.opt_var1_0;
                                cmd.Parameters.Add("@Popt_var2_0", SqlDbType.Decimal).Value = itemRes.opt_var2_0;
                                cmd.Parameters.Add("@Popt_type_1", SqlDbType.SmallInt).Value = itemRes.opt_type_1;
                                cmd.Parameters.Add("@Popt_var1_1", SqlDbType.Decimal).Value = itemRes.opt_var1_1;
                                cmd.Parameters.Add("@Popt_var2_1", SqlDbType.Decimal).Value = itemRes.opt_var2_1;
                                cmd.Parameters.Add("@Popt_type_2", SqlDbType.SmallInt).Value = itemRes.opt_type_2;
                                cmd.Parameters.Add("@Popt_var1_2", SqlDbType.Decimal).Value = itemRes.opt_var1_2;
                                cmd.Parameters.Add("@Popt_var2_2", SqlDbType.Decimal).Value = itemRes.opt_var2_2;
                                cmd.Parameters.Add("@Popt_type_3", SqlDbType.SmallInt).Value = itemRes.opt_type_3;
                                cmd.Parameters.Add("@Popt_var1_3", SqlDbType.Decimal).Value = itemRes.opt_var1_3;
                                cmd.Parameters.Add("@Popt_var2_3", SqlDbType.Decimal).Value = itemRes.opt_var2_3;
                                cmd.Parameters.Add("@Peffect_id", SqlDbType.Int).Value = itemRes.effect_id;
                                cmd.Parameters.Add("@Penhance_0_id", SqlDbType.SmallInt).Value = itemRes.enhance_0_id;
                                cmd.Parameters.Add("@Penhance_0_01", SqlDbType.Decimal).Value = itemRes.enhance_0_01;
                                cmd.Parameters.Add("@Penhance_0_02", SqlDbType.Decimal).Value = itemRes.enhance_0_02;
                                cmd.Parameters.Add("@Penhance_0_03", SqlDbType.Decimal).Value = itemRes.enhance_0_03;
                                cmd.Parameters.Add("@Penhance_0_04", SqlDbType.Decimal).Value = itemRes.enhance_0_04;
                                cmd.Parameters.Add("@Penhance_1_id", SqlDbType.SmallInt).Value = itemRes.enhance_1_id;
                                cmd.Parameters.Add("@Penhance_1_01", SqlDbType.Decimal).Value = itemRes.enhance_1_01;
                                cmd.Parameters.Add("@Penhance_1_02", SqlDbType.Decimal).Value = itemRes.enhance_1_02;
                                cmd.Parameters.Add("@Penhance_1_03", SqlDbType.Decimal).Value = itemRes.enhance_1_03;
                                cmd.Parameters.Add("@Penhance_1_04", SqlDbType.Decimal).Value = itemRes.enhance_1_04;
                                cmd.Parameters.Add("@Pskill_id", SqlDbType.Int).Value = itemRes.skill_id;
                                cmd.Parameters.Add("@Pstate_id", SqlDbType.Int).Value = itemRes.state_id;
                                cmd.Parameters.Add("@Pstate_level", SqlDbType.Int).Value = itemRes.state_level;
                                cmd.Parameters.Add("@Pstate_time", SqlDbType.Int).Value = itemRes.state_time;
                                cmd.Parameters.Add("@Pcool_time", SqlDbType.Int).Value = itemRes.cool_time;
                                cmd.Parameters.Add("@Pcool_time_group", SqlDbType.SmallInt).Value = itemRes.cool_time_group;
                                cmd.Parameters.Add("@Pmodel_type_dem", SqlDbType.Int).Value = itemRes.model_type_dem;
                                cmd.Parameters.Add("@Pmodel_type_def", SqlDbType.Int).Value = itemRes.model_type_def;
                                cmd.Parameters.Add("@Pmodel_type_asm", SqlDbType.Int).Value = itemRes.model_type_asm;
                                cmd.Parameters.Add("@Pmodel_type_asf", SqlDbType.Int).Value = itemRes.model_type_asf;
                                cmd.Parameters.Add("@Pmodel_type_gam", SqlDbType.Int).Value = itemRes.model_type_gam;
                                cmd.Parameters.Add("@Pmodel_type_gaf", SqlDbType.Int).Value = itemRes.model_type_gaf;
                                cmd.Parameters.Add("@Pdeco_model_change", SqlDbType.TinyInt).Value = itemRes.deco_model_change;
                                cmd.Parameters.Add("@Pmodel_00", SqlDbType.VarChar).Value = itemRes.model_00;
                                cmd.Parameters.Add("@Pmodel_01", SqlDbType.VarChar).Value = itemRes.model_01;
                                cmd.Parameters.Add("@Pmodel_02", SqlDbType.VarChar).Value = itemRes.model_02;
                                cmd.Parameters.Add("@Pmodel_03", SqlDbType.VarChar).Value = itemRes.model_03;
                                cmd.Parameters.Add("@Pmodel_04", SqlDbType.VarChar).Value = itemRes.model_04;
                                cmd.Parameters.Add("@Pmodel_05", SqlDbType.VarChar).Value = itemRes.model_05;
                                cmd.Parameters.Add("@Pmodel_06", SqlDbType.VarChar).Value = itemRes.model_06;
                                cmd.Parameters.Add("@Pmodel_07", SqlDbType.VarChar).Value = itemRes.model_07;
                                cmd.Parameters.Add("@Pmodel_08", SqlDbType.VarChar).Value = itemRes.model_08;
                                cmd.Parameters.Add("@Pmodel_09", SqlDbType.VarChar).Value = itemRes.model_09;
                                cmd.Parameters.Add("@Pmodel_10", SqlDbType.VarChar).Value = itemRes.model_10;
                                cmd.Parameters.Add("@Pmodel_11", SqlDbType.VarChar).Value = itemRes.model_11;
                                cmd.Parameters.Add("@Pmodel_12", SqlDbType.VarChar).Value = itemRes.model_12;
                                cmd.Parameters.Add("@Pmodel_13", SqlDbType.VarChar).Value = itemRes.model_13;
                                cmd.Parameters.Add("@Pmodel_14", SqlDbType.VarChar).Value = itemRes.model_14;
                                cmd.Parameters.Add("@Pmodel_15", SqlDbType.VarChar).Value = itemRes.model_15;
                                cmd.Parameters.Add("@Pmodel_16", SqlDbType.VarChar).Value = itemRes.model_16;
                                cmd.Parameters.Add("@Pmodel_17", SqlDbType.VarChar).Value = itemRes.model_17;
                                cmd.Parameters.Add("@Ptexture_filename", SqlDbType.VarChar).Value = itemRes.texture_filename;
                                cmd.Parameters.Add("@Pdrop_type", SqlDbType.VarChar).Value = itemRes.drop_type;
                                cmd.Parameters.Add("@Picon_id", SqlDbType.Int).Value = itemRes.icon_id;
                                cmd.Parameters.Add("@Picon_file_name", SqlDbType.VarChar).Value = itemRes.icon_file_name;
                                cmd.Parameters.Add("@Pscript_text", SqlDbType.VarChar).Value = itemRes.script_text;
                                cmd.ExecuteNonQuery();
                                cmd.Dispose();
                                this.Invoke(new MethodInvoker(delegate { progressBar1.Value++; }));
                            }
                            break;

                        case "JobResource":
                            this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = blJobResource.Count; }));
                            new SqlCommand("TRUNCATE TABLE JobResource", sqlcon).ExecuteNonQuery();
                            foreach (JobResource jobRes in blJobResource)
                            {
                                SqlCommand cmd = new SqlCommand(jobRes.ToDatabase(), sqlcon);
                                cmd.Parameters.Clear();
                                cmd.Parameters.Add("@Pid", SqlDbType.Int).Value = jobRes.id;
                                cmd.Parameters.Add("@Ptext_id", SqlDbType.Int).Value = jobRes.text_id;
                                cmd.Parameters.Add("@Pstati_id", SqlDbType.Int).Value = jobRes.stati_id;
                                cmd.Parameters.Add("@Pjob_class", SqlDbType.Int).Value = jobRes.job_class;
                                cmd.Parameters.Add("@Pjob_depth", SqlDbType.Char).Value = jobRes.job_depth;
                                cmd.Parameters.Add("@Pup_lv", SqlDbType.SmallInt).Value = jobRes.up_lv;
                                cmd.Parameters.Add("@Pup_jlv", SqlDbType.SmallInt).Value = jobRes.up_jlv;
                                cmd.Parameters.Add("@Pavailable_job_0", SqlDbType.SmallInt).Value = jobRes.available_job_0;
                                cmd.Parameters.Add("@Pavailable_job_1", SqlDbType.SmallInt).Value = jobRes.available_job_1;
                                cmd.Parameters.Add("@Pavailable_job_2", SqlDbType.SmallInt).Value = jobRes.available_job_2;
                                cmd.Parameters.Add("@Pavailable_job_3", SqlDbType.SmallInt).Value = jobRes.available_job_3;
                                cmd.Parameters.Add("@Picon_id", SqlDbType.Int).Value = jobRes.icon_id;
                                cmd.Parameters.Add("@Picon_file_name", SqlDbType.VarChar).Value = jobRes.icon_file_name;
                                cmd.ExecuteNonQuery();
                                cmd.Dispose();
                                this.Invoke(new MethodInvoker(delegate { progressBar1.Value++; }));
                            }
                            break;


                        case "PetResource_82":
                            this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = blPetResource_82.Count; }));
                            new SqlCommand("TRUNCATE TABLE PetResource", sqlcon).ExecuteNonQuery();
                            foreach (PetResource_82 petRes82 in blPetResource_82)
                            {
                                SqlCommand cmd = new SqlCommand(petRes82.ToDatabase(), sqlcon);
                                cmd.Parameters.Clear();
                                cmd.Parameters.Add("@id", SqlDbType.Int).Value = petRes82.id;
                                cmd.Parameters.Add("@type", SqlDbType.Int).Value = petRes82.type;
                                cmd.Parameters.Add("@name_id", SqlDbType.Int).Value = petRes82.name_id;
                                cmd.Parameters.Add("@cage_id", SqlDbType.Int).Value = petRes82.cage_id;
                                cmd.Parameters.Add("@rate", SqlDbType.Int).Value = petRes82.attribute_flag;
                                cmd.Parameters.Add("@size", SqlDbType.Decimal).Value = petRes82.size;
                                cmd.Parameters.Add("@scale", SqlDbType.Decimal).Value = petRes82.scale;
                                cmd.Parameters.Add("@target_fx_size", SqlDbType.Decimal).Value = petRes82.target_fx_size;
                                cmd.Parameters.Add("@walk_type", SqlDbType.Int).Value = petRes82.walk_type;
                                cmd.Parameters.Add("@slant_type", SqlDbType.Int).Value = petRes82.slant_type;
                                cmd.Parameters.Add("@camera_x", SqlDbType.Int).Value = petRes82.camera_x;
                                cmd.Parameters.Add("@camera_y", SqlDbType.Int).Value = petRes82.camera_y;
                                cmd.Parameters.Add("@camera_z", SqlDbType.Int).Value = petRes82.camera_z;
                                cmd.Parameters.Add("@target_x", SqlDbType.Decimal).Value = petRes82.target_x;
                                cmd.Parameters.Add("@target_y", SqlDbType.Decimal).Value = petRes82.target_y;
                                cmd.Parameters.Add("@target_z", SqlDbType.Decimal).Value = petRes82.target_z;
                                cmd.Parameters.Add("@model", SqlDbType.VarChar).Value = petRes82.model;
                                cmd.Parameters.Add("@motion_file_id", SqlDbType.Int).Value = petRes82.motion_file_id;
                                cmd.Parameters.Add("@texture_group", SqlDbType.Int).Value = petRes82.texture_group;
                                cmd.Parameters.Add("@local_flag", SqlDbType.Int).Value = petRes82.local_flag;
                                cmd.ExecuteNonQuery();
                                cmd.Dispose();
                                this.Invoke(new MethodInvoker(delegate { progressBar1.Value++; }));
                            }
                            break;

                        case "ModelEffectResource":
                            this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = blModelEffectResource.Count; }));
                            new SqlCommand("TRUNCATE TABLE ModelEffectResource", sqlcon).ExecuteNonQuery();
                            foreach (ModelEffectResource modeleffectRes in blModelEffectResource)
                            {
                                SqlCommand cmd = new SqlCommand(modeleffectRes.ToDatabase(), sqlcon);
                                cmd.Parameters.Clear();
                                cmd.Parameters.Add("@Pid", SqlDbType.Int).Value = modeleffectRes.id;
                                cmd.Parameters.Add("@Peffect_file_ID", SqlDbType.Int).Value = modeleffectRes.effect_file_ID;
                                cmd.Parameters.Add("@Peffect_loop", SqlDbType.Int).Value = modeleffectRes.effect_loop;
                                cmd.Parameters.Add("@Peffect_position", SqlDbType.Int).Value = modeleffectRes.effect_position;
                                cmd.Parameters.Add("@Pswap_event_id", SqlDbType.Int).Value = modeleffectRes.swap_event_id;
                                cmd.Parameters.Add("@Pswap_model_ID", SqlDbType.Int).Value = modeleffectRes.swap_model_ID;
                                cmd.Parameters.Add("@Pbone_name_01", SqlDbType.VarChar).Value = modeleffectRes.bone_name_01;
                                cmd.Parameters.Add("@Pbone_effect_01", SqlDbType.Int).Value = modeleffectRes.bone_effect_01;
                                cmd.Parameters.Add("@Pbone_name_02", SqlDbType.VarChar).Value = modeleffectRes.bone_name_02;
                                cmd.Parameters.Add("@Pbone_effect_02", SqlDbType.Int).Value = modeleffectRes.bone_effect_02;
                                cmd.Parameters.Add("@Pbone_name_03", SqlDbType.VarChar).Value = modeleffectRes.bone_name_03;
                                cmd.Parameters.Add("@Pbone_effect_03", SqlDbType.Int).Value = modeleffectRes.bone_effect_03;
                                cmd.Parameters.Add("@Pbone_name_04", SqlDbType.VarChar).Value = modeleffectRes.bone_name_04;
                                cmd.Parameters.Add("@Pbone_effect_04", SqlDbType.Int).Value = modeleffectRes.bone_effect_04;
                                cmd.Parameters.Add("@Pbone_name_05", SqlDbType.VarChar).Value = modeleffectRes.bone_name_05;
                                cmd.Parameters.Add("@Pbone_effect_05", SqlDbType.Int).Value = modeleffectRes.bone_effect_05;
                                cmd.Parameters.Add("@Pbone_name_06", SqlDbType.VarChar).Value = modeleffectRes.bone_name_06;
                                cmd.Parameters.Add("@Pbone_effect_06", SqlDbType.Int).Value = modeleffectRes.bone_effect_06;
                                cmd.Parameters.Add("@Pbone_name_07", SqlDbType.VarChar).Value = modeleffectRes.bone_name_07;
                                cmd.Parameters.Add("@Pbone_effect_07", SqlDbType.Int).Value = modeleffectRes.bone_effect_07;
                                cmd.Parameters.Add("@Pbone_name_08", SqlDbType.VarChar).Value = modeleffectRes.bone_name_08;
                                cmd.Parameters.Add("@Pbone_effect_08", SqlDbType.Int).Value = modeleffectRes.bone_effect_08;
                                cmd.Parameters.Add("@Pbone_name_09", SqlDbType.VarChar).Value = modeleffectRes.bone_name_09;
                                cmd.Parameters.Add("@Pbone_effect_09", SqlDbType.Int).Value = modeleffectRes.bone_effect_09;
                                cmd.Parameters.Add("@Pbone_name_10", SqlDbType.VarChar).Value = modeleffectRes.bone_name_10;
                                cmd.Parameters.Add("@Pbone_effect_10", SqlDbType.Int).Value = modeleffectRes.bone_effect_10;
                                cmd.Parameters.Add("@Pbone_name_11", SqlDbType.VarChar).Value = modeleffectRes.bone_name_11;
                                cmd.Parameters.Add("@Pbone_effect_11", SqlDbType.Int).Value = modeleffectRes.bone_effect_11;
                                cmd.Parameters.Add("@Pbone_name_12", SqlDbType.VarChar).Value = modeleffectRes.bone_name_12;
                                cmd.Parameters.Add("@Pbone_effect_12", SqlDbType.Int).Value = modeleffectRes.bone_effect_12;
                                cmd.Parameters.Add("@Pbone_name_13", SqlDbType.VarChar).Value = modeleffectRes.bone_name_13;
                                cmd.Parameters.Add("@Pbone_effect_13", SqlDbType.Int).Value = modeleffectRes.bone_effect_13;
                                cmd.Parameters.Add("@Pbone_name_14", SqlDbType.VarChar).Value = modeleffectRes.bone_name_14;
                                cmd.Parameters.Add("@Pbone_effect_14", SqlDbType.Int).Value = modeleffectRes.bone_effect_14;
                                cmd.Parameters.Add("@Pbone_name_15", SqlDbType.VarChar).Value = modeleffectRes.bone_name_15;
                                cmd.Parameters.Add("@Pbone_effect_15", SqlDbType.Int).Value = modeleffectRes.bone_effect_15;
                                cmd.ExecuteNonQuery();
                                cmd.Dispose();
                                this.Invoke(new MethodInvoker(delegate { progressBar1.Value++; }));
                            }
                            break;

                        case "MonsterMotionSet":
                            this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = blMonsterMotionSet.Count; }));
                            new SqlCommand("TRUNCATE TABLE MonsterMotionSet", sqlcon).ExecuteNonQuery();
                            foreach (MonsterMotionSet motionRes in blMonsterMotionSet)
                            {
                                SqlCommand cmd = new SqlCommand(motionRes.ToDatabase(), sqlcon);
                                cmd.Parameters.Clear();
                                cmd.Parameters.Add("@Pcharacter_id", SqlDbType.Int).Value = motionRes.character_id;
                                cmd.Parameters.Add("@Pdef", SqlDbType.VarChar).Value = motionRes.def;
                                cmd.Parameters.Add("@Pbattle", SqlDbType.VarChar).Value = motionRes.battle;
                                cmd.Parameters.Add("@Pidle", SqlDbType.VarChar).Value = motionRes.idle;
                                cmd.Parameters.Add("@Pwalk", SqlDbType.VarChar).Value = motionRes.walk;
                                cmd.Parameters.Add("@Prun", SqlDbType.VarChar).Value = motionRes.run;
                                cmd.Parameters.Add("@Pbe_attack", SqlDbType.VarChar).Value = motionRes.be_attack;
                                cmd.Parameters.Add("@Pbe_attack2", SqlDbType.VarChar).Value = motionRes.be_attack2;
                                cmd.Parameters.Add("@Pdead", SqlDbType.VarChar).Value = motionRes.dead;
                                cmd.Parameters.Add("@Pflying_dead", SqlDbType.VarChar).Value = motionRes.flying_dead;
                                cmd.Parameters.Add("@Ptake", SqlDbType.VarChar).Value = motionRes.take;
                                cmd.Parameters.Add("@Pattack_1", SqlDbType.VarChar).Value = motionRes.attack_1;
                                cmd.Parameters.Add("@Pattack_2", SqlDbType.VarChar).Value = motionRes.attack_2;
                                cmd.Parameters.Add("@Pattack_3", SqlDbType.VarChar).Value = motionRes.attack_3;
                                cmd.Parameters.Add("@Pdraw_bow", SqlDbType.VarChar).Value = motionRes.draw_bow;
                                cmd.Parameters.Add("@Ptarget_bow", SqlDbType.VarChar).Value = motionRes.target_bow;
                                cmd.Parameters.Add("@Pfire_bow", SqlDbType.VarChar).Value = motionRes.fire_bow;
                                cmd.Parameters.Add("@Pcasting_1", SqlDbType.VarChar).Value = motionRes.casting_1;
                                cmd.Parameters.Add("@Pcasting_2", SqlDbType.VarChar).Value = motionRes.casting_2;
                                cmd.Parameters.Add("@Pcasting_3", SqlDbType.VarChar).Value = motionRes.casting_3;
                                cmd.Parameters.Add("@Pmelee_1", SqlDbType.VarChar).Value = motionRes.melee_1;
                                cmd.Parameters.Add("@Pmelee_2", SqlDbType.VarChar).Value = motionRes.melee_2;
                                cmd.Parameters.Add("@Pmelee_3", SqlDbType.VarChar).Value = motionRes.melee_3;
                                cmd.Parameters.Add("@Pmount", SqlDbType.VarChar).Value = motionRes.mount;
                                cmd.Parameters.Add("@Punmount", SqlDbType.VarChar).Value = motionRes.unmount;
                                cmd.ExecuteNonQuery();
                                cmd.Dispose();
                                this.Invoke(new MethodInvoker(delegate { progressBar1.Value++; }));
                            }
                            break;

                        case "MonsterResource":
                            this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = blMonsterResource.Count; }));
                            new SqlCommand("TRUNCATE TABLE MonsterResource", sqlcon).ExecuteNonQuery();
                            foreach (MonsterResource mobRes in blMonsterResource)
                            {
                                SqlCommand cmd = new SqlCommand(mobRes.ToDatabase(), sqlcon);
                                cmd.Parameters.Clear();
                                cmd.Parameters.Add("@Pid", SqlDbType.Int).Value = mobRes.id;
                                cmd.Parameters.Add("@Pmonster_group", SqlDbType.Int).Value = mobRes.monster_group;
                                cmd.Parameters.Add("@Pname_id", SqlDbType.Int).Value = mobRes.name_id;
                                cmd.Parameters.Add("@Plocation_id", SqlDbType.Int).Value = mobRes.location_id;
                                cmd.Parameters.Add("@Pmodel", SqlDbType.VarChar).Value = mobRes.model;
                                cmd.Parameters.Add("@Pmotion_file_id", SqlDbType.Int).Value = mobRes.motion_file_id;
                                cmd.Parameters.Add("@Ptransform_level", SqlDbType.Int).Value = mobRes.transform_level;
                                cmd.Parameters.Add("@Pwalk_type", SqlDbType.TinyInt).Value = mobRes.walk_type;
                                cmd.Parameters.Add("@Pslant_type", SqlDbType.TinyInt).Value = mobRes.slant_type;
                                cmd.Parameters.Add("@Psize", SqlDbType.Decimal).Value = mobRes.size;
                                cmd.Parameters.Add("@Pscale", SqlDbType.Decimal).Value = mobRes.scale;
                                cmd.Parameters.Add("@Ptarget_fx_size", SqlDbType.Decimal).Value = mobRes.target_fx_size;
                                cmd.Parameters.Add("@Pcamera_x", SqlDbType.Int).Value = mobRes.camera_x;
                                cmd.Parameters.Add("@Pcamera_y", SqlDbType.Int).Value = mobRes.camera_y;
                                cmd.Parameters.Add("@Pcamera_z", SqlDbType.Int).Value = mobRes.camera_z;
                                cmd.Parameters.Add("@Ptarget_x", SqlDbType.Decimal).Value = mobRes.target_x;
                                cmd.Parameters.Add("@Ptarget_y", SqlDbType.Decimal).Value = mobRes.target_y;
                                cmd.Parameters.Add("@Ptarget_z", SqlDbType.Decimal).Value = mobRes.target_z;
                                cmd.Parameters.Add("@Plevel", SqlDbType.Int).Value = mobRes.level;
                                cmd.Parameters.Add("@Pgrp", SqlDbType.Int).Value = mobRes.grp;
                                cmd.Parameters.Add("@Pmagic_type", SqlDbType.Int).Value = mobRes.magic_type;
                                cmd.Parameters.Add("@Prace", SqlDbType.Int).Value = mobRes.race;
                                cmd.Parameters.Add("@Pvisible_range", SqlDbType.Int).Value = mobRes.visible_range;
                                cmd.Parameters.Add("@Pchase_range", SqlDbType.Int).Value = mobRes.chase_range;
                                cmd.Parameters.Add("@Pf_fisrt_attack", SqlDbType.TinyInt).Value = mobRes.f_fisrt_attack;
                                cmd.Parameters.Add("@Pf_group_first_attack", SqlDbType.TinyInt).Value = mobRes.f_group_first_attack;
                                cmd.Parameters.Add("@Pf_response_casting", SqlDbType.TinyInt).Value = mobRes.f_response_casting;
                                cmd.Parameters.Add("@Pf_response_race", SqlDbType.TinyInt).Value = mobRes.f_response_race;
                                cmd.Parameters.Add("@Pf_response_battle", SqlDbType.TinyInt).Value = mobRes.f_response_battle;
                                cmd.Parameters.Add("@Pmonster_type", SqlDbType.TinyInt).Value = mobRes.monster_type;
                                cmd.Parameters.Add("@Pstat_id", SqlDbType.Int).Value = mobRes.stat_id;
                                cmd.Parameters.Add("@Pfight_type", SqlDbType.Int).Value = mobRes.fight_type;
                                cmd.Parameters.Add("@Pmonster_skill_link_id", SqlDbType.Int).Value = mobRes.monster_skill_link_id;
                                cmd.Parameters.Add("@Pmaterial", SqlDbType.Int).Value = mobRes.material;
                                cmd.Parameters.Add("@Pweapon_type", SqlDbType.Int).Value = mobRes.weapon_type;
                                cmd.Parameters.Add("@Pattack_motion_speed", SqlDbType.Int).Value = mobRes.attack_motion_speed;
                                cmd.Parameters.Add("@Pability", SqlDbType.Int).Value = mobRes.ability;
                                cmd.Parameters.Add("@Pstandard_walk_spped", SqlDbType.Int).Value = mobRes.standard_walk_spped;
                                cmd.Parameters.Add("@Pstandard_run_spped", SqlDbType.Int).Value = mobRes.standard_run_spped;
                                cmd.Parameters.Add("@Pwalk_speed", SqlDbType.Int).Value = mobRes.walk_speed;
                                cmd.Parameters.Add("@Prun_speed", SqlDbType.Int).Value = mobRes.run_speed;
                                cmd.Parameters.Add("@Pattack_range", SqlDbType.Decimal).Value = mobRes.attack_range;
                                cmd.Parameters.Add("@Phidesense_range", SqlDbType.Decimal).Value = mobRes.hidesense_range;
                                cmd.Parameters.Add("@Php", SqlDbType.Int).Value = mobRes.hp;
                                cmd.Parameters.Add("@Pmp", SqlDbType.Int).Value = mobRes.mp;
                                cmd.Parameters.Add("@Pattack_point", SqlDbType.Int).Value = mobRes.attack_point;
                                cmd.Parameters.Add("@Pmagic_point", SqlDbType.Int).Value = mobRes.magic_point;
                                cmd.Parameters.Add("@Pdefence", SqlDbType.Int).Value = mobRes.defence;
                                cmd.Parameters.Add("@Pmagic_defence", SqlDbType.Int).Value = mobRes.magic_defence;
                                cmd.Parameters.Add("@Pattack_speed", SqlDbType.Int).Value = mobRes.attack_speed;
                                cmd.Parameters.Add("@Pmagic_speed", SqlDbType.Int).Value = mobRes.magic_speed;
                                cmd.Parameters.Add("@Paccuracy", SqlDbType.Int).Value = mobRes.accuracy;
                                cmd.Parameters.Add("@Pavoid", SqlDbType.Int).Value = mobRes.avoid;
                                cmd.Parameters.Add("@Pmagic_accuracy", SqlDbType.Int).Value = mobRes.magic_accuracy;
                                cmd.Parameters.Add("@Pmagic_avoid", SqlDbType.Int).Value = mobRes.magic_avoid;
                                cmd.Parameters.Add("@Ptaming_id", SqlDbType.Int).Value = mobRes.taming_id;
                                cmd.Parameters.Add("@Ptaming_percentage", SqlDbType.Decimal).Value = mobRes.taming_percentage;
                                cmd.Parameters.Add("@Ptaming_exp_mod", SqlDbType.Decimal).Value = mobRes.taming_exp_mod;
                                cmd.Parameters.Add("@Pexp", SqlDbType.Int).Value = mobRes.exp;
                                cmd.Parameters.Add("@Pjp", SqlDbType.Int).Value = mobRes.jp;
                                cmd.Parameters.Add("@Pgold_drop_percentage", SqlDbType.Int).Value = mobRes.gold_drop_percentage;
                                cmd.Parameters.Add("@Pgold_min", SqlDbType.Int).Value = mobRes.gold_min;
                                cmd.Parameters.Add("@Pgold_max", SqlDbType.Int).Value = mobRes.gold_max;
                                cmd.Parameters.Add("@Pchaos_drop_percentage", SqlDbType.Int).Value = mobRes.chaos_drop_percentage;
                                cmd.Parameters.Add("@Pchaos_min", SqlDbType.Int).Value = mobRes.chaos_min;
                                cmd.Parameters.Add("@Pchaos_max", SqlDbType.Int).Value = mobRes.chaos_max;
                                cmd.Parameters.Add("@Pexp_2", SqlDbType.Int).Value = mobRes.exp_2;
                                cmd.Parameters.Add("@Pjp_2", SqlDbType.Int).Value = mobRes.jp_2;
                                cmd.Parameters.Add("@Pgold_min_2", SqlDbType.Int).Value = mobRes.gold_min_2;
                                cmd.Parameters.Add("@Pgold_max_2", SqlDbType.Int).Value = mobRes.gold_max_2;
                                cmd.Parameters.Add("@Pchaos_min_2", SqlDbType.Int).Value = mobRes.chaos_min_2;
                                cmd.Parameters.Add("@Pchaos_max_2", SqlDbType.Int).Value = mobRes.chaos_max_2;
                                cmd.Parameters.Add("@Pdrop_table_link_id", SqlDbType.Int).Value = mobRes.drop_table_link_id;
                                cmd.Parameters.Add("@Ptexture_group", SqlDbType.Int).Value = mobRes.texture_group;
                                cmd.Parameters.Add("@Plocal_flag", SqlDbType.Int).Value = mobRes.local_flag;
                                cmd.Parameters.Add("@Pscript_on_dead", SqlDbType.VarChar).Value = mobRes.script_on_dead;
                                cmd.ExecuteNonQuery();
                                cmd.Dispose();
                                this.Invoke(new MethodInvoker(delegate { progressBar1.Value++; }));
                            }
                            break;

                        case "QuestResource":
                            this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = blQuestResource.Count; }));
                            new SqlCommand("TRUNCATE TABLE QuestResource", sqlcon).ExecuteNonQuery();
                            foreach (QuestResource questRes in blQuestResource)
                            {
                                SqlCommand cmd = new SqlCommand(questRes.ToDatabase(), sqlcon);
                                cmd.Parameters.Clear();
                                cmd.Parameters.Add("@Pid", SqlDbType.Int).Value = questRes.id;
                                cmd.Parameters.Add("@Ptext_id_quest", SqlDbType.Int).Value = questRes.text_id_quest;
                                cmd.Parameters.Add("@Ptext_id_summary", SqlDbType.Int).Value = questRes.text_id_summary;
                                cmd.Parameters.Add("@Ptext_id_status", SqlDbType.Int).Value = questRes.text_id_status;
                                cmd.Parameters.Add("@Plimit_begin_time", SqlDbType.Int).Value = questRes.limit_begin_time;
                                cmd.Parameters.Add("@Plimit_end_time", SqlDbType.Int).Value = questRes.limit_end_time;
                                cmd.Parameters.Add("@Plimit_level", SqlDbType.Int).Value = questRes.limit_level;
                                cmd.Parameters.Add("@Plimit_job_level", SqlDbType.Int).Value = questRes.limit_job_level;
                                cmd.Parameters.Add("@Plimit_max_level", SqlDbType.Int).Value = questRes.limit_max_level;
                                cmd.Parameters.Add("@Plimit_max_job_level", SqlDbType.Int).Value = questRes.limit_max_job_level;
                                cmd.Parameters.Add("@Plimit_deva", SqlDbType.Char).Value = questRes.limit_deva;
                                cmd.Parameters.Add("@Plimit_asura", SqlDbType.Char).Value = questRes.limit_asura;
                                cmd.Parameters.Add("@Plimit_gaia", SqlDbType.Char).Value = questRes.limit_gaia;
                                cmd.Parameters.Add("@Plimit_fighter", SqlDbType.Char).Value = questRes.limit_fighter;
                                cmd.Parameters.Add("@Plimit_hunter", SqlDbType.Char).Value = questRes.limit_hunter;
                                cmd.Parameters.Add("@Plimit_magician", SqlDbType.Char).Value = questRes.limit_magician;
                                cmd.Parameters.Add("@Plimit_summoner", SqlDbType.Char).Value = questRes.limit_summoner;
                                cmd.Parameters.Add("@Plimit_job", SqlDbType.Int).Value = questRes.limit_job;
                                cmd.Parameters.Add("@Pjob_depth", SqlDbType.TinyInt).Value = questRes.job_depth;
                                cmd.Parameters.Add("@Plimit_favor_group_id", SqlDbType.Int).Value = questRes.limit_favor_group_id;
                                cmd.Parameters.Add("@Plimit_favor", SqlDbType.Int).Value = questRes.limit_favor;
                                cmd.Parameters.Add("@Prepeatable", SqlDbType.Char).Value = questRes.repeatable;
                                cmd.Parameters.Add("@Pinvoke_condition", SqlDbType.Int).Value = questRes.invoke_condition;
                                cmd.Parameters.Add("@Pinvoke_value", SqlDbType.Int).Value = questRes.invoke_value;
                                cmd.Parameters.Add("@Ptime_limit_type", SqlDbType.Char).Value = questRes.time_limit_type;
                                cmd.Parameters.Add("@Ptime_limit", SqlDbType.Int).Value = questRes.time_limit;
                                cmd.Parameters.Add("@Ptype", SqlDbType.Int).Value = questRes.type;
                                cmd.Parameters.Add("@Pvalue1", SqlDbType.Int).Value = questRes.value1;
                                cmd.Parameters.Add("@Pvalue2", SqlDbType.Int).Value = questRes.value2;
                                cmd.Parameters.Add("@Pvalue3", SqlDbType.Int).Value = questRes.value3;
                                cmd.Parameters.Add("@Pvalue4", SqlDbType.Int).Value = questRes.value4;
                                cmd.Parameters.Add("@Pvalue5", SqlDbType.Int).Value = questRes.value5;
                                cmd.Parameters.Add("@Pvalue6", SqlDbType.Int).Value = questRes.value6;
                                cmd.Parameters.Add("@Pvalue7", SqlDbType.Int).Value = questRes.value7;
                                cmd.Parameters.Add("@Pvalue8", SqlDbType.Int).Value = questRes.value8;
                                cmd.Parameters.Add("@Pvalue9", SqlDbType.Int).Value = questRes.value9;
                                cmd.Parameters.Add("@Pvalue10", SqlDbType.Int).Value = questRes.value10;
                                cmd.Parameters.Add("@Pvalue11", SqlDbType.Int).Value = questRes.value11;
                                cmd.Parameters.Add("@Pvalue12", SqlDbType.Int).Value = questRes.value12;
                                cmd.Parameters.Add("@Pdrop_group_id", SqlDbType.Int).Value = questRes.drop_group_id;
                                cmd.Parameters.Add("@Pquest_difficulty", SqlDbType.Int).Value = questRes.quest_difficulty;
                                cmd.Parameters.Add("@Pfavor_group_id", SqlDbType.Int).Value = questRes.favor_group_id;
                                cmd.Parameters.Add("@Phate_group_id", SqlDbType.Int).Value = questRes.hate_group_id;
                                cmd.Parameters.Add("@Pfavor", SqlDbType.Int).Value = questRes.favor;
                                cmd.Parameters.Add("@Pexp", SqlDbType.BigInt).Value = questRes.exp;
                                cmd.Parameters.Add("@Pjp", SqlDbType.Int).Value = questRes.jp;
                                cmd.Parameters.Add("@Pholicpoint", SqlDbType.Int).Value = questRes.holicpoint;
                                cmd.Parameters.Add("@Pgold", SqlDbType.Int).Value = questRes.gold;
                                cmd.Parameters.Add("@Pdefault_reward_id", SqlDbType.Int).Value = questRes.default_reward_id;
                                cmd.Parameters.Add("@Pdefault_reward_level", SqlDbType.Int).Value = questRes.default_reward_level;
                                cmd.Parameters.Add("@Pdefault_reward_quantity", SqlDbType.Int).Value = questRes.default_reward_quantity;
                                cmd.Parameters.Add("@Poptional_reward_id1", SqlDbType.Int).Value = questRes.optional_reward_id1;
                                cmd.Parameters.Add("@Poptional_reward_level1", SqlDbType.Int).Value = questRes.optional_reward_level1;
                                cmd.Parameters.Add("@Poptional_reward_quantity1", SqlDbType.Int).Value = questRes.optional_reward_quantity1;
                                cmd.Parameters.Add("@Poptional_reward_id2", SqlDbType.Int).Value = questRes.optional_reward_id2;
                                cmd.Parameters.Add("@Poptional_reward_level2", SqlDbType.Int).Value = questRes.optional_reward_level2;
                                cmd.Parameters.Add("@Poptional_reward_quantity2", SqlDbType.Int).Value = questRes.optional_reward_quantity2;
                                cmd.Parameters.Add("@Poptional_reward_id3", SqlDbType.Int).Value = questRes.optional_reward_id3;
                                cmd.Parameters.Add("@Poptional_reward_level3", SqlDbType.Int).Value = questRes.optional_reward_level3;
                                cmd.Parameters.Add("@Poptional_reward_quantity3", SqlDbType.Int).Value = questRes.optional_reward_quantity3;
                                cmd.Parameters.Add("@Poptional_reward_id4", SqlDbType.Int).Value = questRes.optional_reward_id4;
                                cmd.Parameters.Add("@Poptional_reward_level4", SqlDbType.Int).Value = questRes.optional_reward_level3;
                                cmd.Parameters.Add("@Poptional_reward_quantity4", SqlDbType.Int).Value = questRes.optional_reward_quantity4;
                                cmd.Parameters.Add("@Poptional_reward_id5", SqlDbType.Int).Value = questRes.optional_reward_id5; ;
                                cmd.Parameters.Add("@Poptional_reward_level5", SqlDbType.Int).Value = questRes.optional_reward_level5;
                                cmd.Parameters.Add("@Poptional_reward_quantity5", SqlDbType.Int).Value = questRes.optional_reward_quantity5;
                                cmd.Parameters.Add("@Poptional_reward_id6", SqlDbType.Int).Value = questRes.optional_reward_id6;
                                cmd.Parameters.Add("@Poptional_reward_level6", SqlDbType.Int).Value = questRes.optional_reward_level6;
                                cmd.Parameters.Add("@Poptional_reward_quantity6", SqlDbType.Int).Value = questRes.optional_reward_quantity6;
                                cmd.Parameters.Add("@Pforequest1", SqlDbType.Int).Value = questRes.forequest1;
                                cmd.Parameters.Add("@Pforequest2", SqlDbType.Int).Value = questRes.forequest2;
                                cmd.Parameters.Add("@Pforequest3", SqlDbType.Int).Value = questRes.forequest3;
                                cmd.Parameters.Add("@Por_flag", SqlDbType.Char).Value = questRes.or_flag;
                                cmd.Parameters.Add("@Pscript_start_text", SqlDbType.VarChar).Value = "";
                                cmd.Parameters.Add("@Pscript_end_text", SqlDbType.VarChar).Value = "";
                                cmd.Parameters.Add("@Pscript_drop_text", SqlDbType.VarChar).Value = "";
                                cmd.Parameters.Add("@Pshow_target_type", SqlDbType.Char).Value = questRes.show_target_type;
                                cmd.Parameters.Add("@Pshow_target_id", SqlDbType.Int).Value = questRes.show_target_id;
                                cmd.Parameters.Add("@Pmark_hide", SqlDbType.Char).Value = questRes.mark_hide;
                                cmd.Parameters.Add("@Pcool_time", SqlDbType.Int).Value = questRes.cool_time;
                                cmd.Parameters.Add("@Paccept_cool_time", SqlDbType.Int).Value = questRes.accept_cool_time;
                                cmd.ExecuteNonQuery();
                                cmd.Dispose();
                                this.Invoke(new MethodInvoker(delegate { progressBar1.Value++; }));
                            }
                            break;

                        case "SkillResource":
                            this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = blSkillResource.Count; }));
                            new SqlCommand("TRUNCATE TABLE SkillResource", sqlcon).ExecuteNonQuery();
                            new SqlCommand("TRUNCATE TABLE SkillJPResource", sqlcon).ExecuteNonQuery();
                            foreach (SkillResource skillRes in blSkillResource)
                            {
                                SqlCommand cmd = new SqlCommand(skillRes.ToDatabase(), sqlcon);
                                cmd.Parameters.Clear();
                                cmd.Parameters.Add("@Pid", SqlDbType.Int).Value = skillRes.id;
                                cmd.Parameters.Add("@Ptext_id", SqlDbType.Int).Value = skillRes.text_id;
                                cmd.Parameters.Add("@Pdesc_id", SqlDbType.Int).Value = skillRes.desc_id;
                                cmd.Parameters.Add("@Ptooltip_id", SqlDbType.Int).Value = skillRes.tooltip_id;
                                cmd.Parameters.Add("@Pis_valid", SqlDbType.TinyInt).Value = skillRes.is_valid;
                                cmd.Parameters.Add("@Pelemental", SqlDbType.Char).Value = skillRes.elemental;
                                cmd.Parameters.Add("@Pis_passive", SqlDbType.Char).Value = skillRes.is_passive;
                                cmd.Parameters.Add("@Pis_physical_act", SqlDbType.Char).Value = skillRes.is_physical_act;
                                cmd.Parameters.Add("@Pis_harmful", SqlDbType.Char).Value = skillRes.is_harmful;
                                cmd.Parameters.Add("@Pis_need_target", SqlDbType.Char).Value = skillRes.is_need_target;
                                cmd.Parameters.Add("@Pis_corpse", SqlDbType.Char).Value = skillRes.is_corpse;
                                cmd.Parameters.Add("@Pis_toggle", SqlDbType.Char).Value = skillRes.is_toggle;
                                cmd.Parameters.Add("@Ptoggle_group", SqlDbType.Int).Value = skillRes.toggle_group;
                                cmd.Parameters.Add("@Pcasting_type", SqlDbType.Char).Value = skillRes.casting_type;
                                cmd.Parameters.Add("@Pcasting_level", SqlDbType.Char).Value = skillRes.casting_level;
                                cmd.Parameters.Add("@Pcast_range", SqlDbType.Int).Value = skillRes.cast_range;
                                cmd.Parameters.Add("@Pvalid_range", SqlDbType.Int).Value = skillRes.valid_range;
                                cmd.Parameters.Add("@Pcost_hp", SqlDbType.Int).Value = skillRes.cost_hp;
                                cmd.Parameters.Add("@Pcost_hp_per_skl", SqlDbType.Int).Value = skillRes.cost_hp_per_skl;
                                cmd.Parameters.Add("@Pcost_mp", SqlDbType.Int).Value = skillRes.cost_mp;
                                cmd.Parameters.Add("@Pcost_mp_per_skl", SqlDbType.Int).Value = skillRes.cost_mp_per_skl;
                                cmd.Parameters.Add("@Pcost_mp_per_enhance", SqlDbType.Int).Value = skillRes.cost_mp_per_enhance;
                                cmd.Parameters.Add("@Pcost_hp_per", SqlDbType.Decimal).Value = skillRes.cost_hp_per;
                                cmd.Parameters.Add("@Pcost_hp_per_skl_per", SqlDbType.Decimal).Value = skillRes.cost_hp_per_skl_per;
                                cmd.Parameters.Add("@Pcost_mp_per", SqlDbType.Decimal).Value = skillRes.cost_mp_per;
                                cmd.Parameters.Add("@Pcost_mp_per_skl_per", SqlDbType.Decimal).Value = skillRes.cost_mp_per_skl_per;
                                cmd.Parameters.Add("@Pcost_havoc", SqlDbType.Int).Value = skillRes.cost_havoc;
                                cmd.Parameters.Add("@Pcost_havoc_per_skl", SqlDbType.Int).Value = skillRes.cost_havoc_per_skl;
                                cmd.Parameters.Add("@Pcost_energy", SqlDbType.Decimal).Value = skillRes.cost_energy;
                                cmd.Parameters.Add("@Pcost_energy_per_skl", SqlDbType.Decimal).Value = skillRes.cost_energy_per_skl;
                                cmd.Parameters.Add("@Pcost_exp", SqlDbType.Int).Value = skillRes.cost_exp;
                                cmd.Parameters.Add("@Pcost_exp_per_enhance", SqlDbType.Int).Value = skillRes.cost_exp_per_enhance;
                                cmd.Parameters.Add("@Pcost_jp", SqlDbType.Int).Value = skillRes.cost_jp;
                                cmd.Parameters.Add("@Pcost_jp_per_enhance", SqlDbType.Int).Value = skillRes.cost_jp_per_enhance;
                                cmd.Parameters.Add("@Pcost_item", SqlDbType.Int).Value = skillRes.cost_item;
                                cmd.Parameters.Add("@Pcost_item_count", SqlDbType.Int).Value = skillRes.cost_item_count;
                                cmd.Parameters.Add("@Pcost_item_count_per_skl", SqlDbType.Int).Value = skillRes.cost_item_count_per_skl;
                                cmd.Parameters.Add("@Pneed_level", SqlDbType.Int).Value = skillRes.need_level;
                                cmd.Parameters.Add("@Pneed_hp", SqlDbType.Int).Value = skillRes.need_hp;
                                cmd.Parameters.Add("@Pneed_mp", SqlDbType.Int).Value = skillRes.need_mp;
                                cmd.Parameters.Add("@Pneed_havoc", SqlDbType.Int).Value = skillRes.need_havoc;
                                cmd.Parameters.Add("@Pneed_havoc_burst", SqlDbType.Int).Value = skillRes.need_havoc_burst;
                                cmd.Parameters.Add("@Pneed_state_id", SqlDbType.Int).Value = skillRes.need_state_id;
                                cmd.Parameters.Add("@Pneed_state_level", SqlDbType.TinyInt).Value = skillRes.need_state_level;
                                cmd.Parameters.Add("@Pneed_state_exhaust", SqlDbType.TinyInt).Value = skillRes.need_state_exhaust;
                                cmd.Parameters.Add("@Pvf_one_hand_sword", SqlDbType.Char).Value = skillRes.vf_one_hand_sword;
                                cmd.Parameters.Add("@Pvf_two_hand_sword", SqlDbType.Char).Value = skillRes.vf_two_hand_sword;
                                cmd.Parameters.Add("@Pvf_double_sword", SqlDbType.Char).Value = skillRes.vf_double_sword;
                                cmd.Parameters.Add("@Pvf_dagger", SqlDbType.Char).Value = skillRes.vf_dagger;
                                cmd.Parameters.Add("@Pvf_double_dagger", SqlDbType.Char).Value = skillRes.vf_double_dagger;
                                cmd.Parameters.Add("@Pvf_spear", SqlDbType.Char).Value = skillRes.vf_spear;
                                cmd.Parameters.Add("@Pvf_axe", SqlDbType.Char).Value = skillRes.vf_axe;
                                cmd.Parameters.Add("@Pvf_one_hand_axe", SqlDbType.Char).Value = skillRes.vf_one_hand_axe;
                                cmd.Parameters.Add("@Pvf_double_axe", SqlDbType.Char).Value = skillRes.vf_double_axe;
                                cmd.Parameters.Add("@Pvf_one_hand_mace", SqlDbType.Char).Value = skillRes.vf_one_hand_mace;
                                cmd.Parameters.Add("@Pvf_two_hand_mace", SqlDbType.Char).Value = skillRes.vf_two_hand_mace;
                                cmd.Parameters.Add("@Pvf_lightbow", SqlDbType.Char).Value = skillRes.vf_lightbow;
                                cmd.Parameters.Add("@Pvf_heavybow", SqlDbType.Char).Value = skillRes.vf_heavybow;
                                cmd.Parameters.Add("@Pvf_crossbow", SqlDbType.Char).Value = skillRes.vf_crossbow;
                                cmd.Parameters.Add("@Pvf_one_hand_staff", SqlDbType.Char).Value = skillRes.vf_one_hand_staff;
                                cmd.Parameters.Add("@Pvf_two_hand_staff", SqlDbType.Char).Value = skillRes.vf_two_hand_staff;
                                cmd.Parameters.Add("@Pvf_shield_only", SqlDbType.Char).Value = skillRes.vf_shield_only;
                                cmd.Parameters.Add("@Pvf_is_not_need_weapon", SqlDbType.Char).Value = skillRes.vf_is_not_need_weapon;
                                cmd.Parameters.Add("@Pdelay_cast", SqlDbType.Decimal).Value = skillRes.delay_cast;
                                cmd.Parameters.Add("@Pdelay_cast_per_skl", SqlDbType.Decimal).Value = skillRes.delay_cast_per_skl;
                                cmd.Parameters.Add("@Pdelay_cast_mode_per_enhance", SqlDbType.Decimal).Value = skillRes.delay_cast_mode_per_enhance;
                                cmd.Parameters.Add("@Pdelay_common", SqlDbType.Decimal).Value = skillRes.delay_common;
                                cmd.Parameters.Add("@Pdelay_cooltime", SqlDbType.Decimal).Value = skillRes.delay_cooltime;
                                cmd.Parameters.Add("@Pdelay_cooltime_per_skl", SqlDbType.Decimal).Value = skillRes.delay_cooltime_per_skl;
                                cmd.Parameters.Add("@Pdelay_cooltime_mode_per_enhance", SqlDbType.Decimal).Value = skillRes.delay_cooltime_mode_per_enhance;
                                cmd.Parameters.Add("@Pcool_time_group_id", SqlDbType.Int).Value = skillRes.cool_time_group_id;
                                cmd.Parameters.Add("@Puf_self", SqlDbType.Char).Value = skillRes.uf_self;
                                cmd.Parameters.Add("@Puf_party", SqlDbType.Char).Value = skillRes.uf_party;
                                cmd.Parameters.Add("@Puf_guild", SqlDbType.Char).Value = skillRes.uf_guild;
                                cmd.Parameters.Add("@Puf_neutral", SqlDbType.Char).Value = skillRes.uf_neutral;
                                cmd.Parameters.Add("@Puf_purple", SqlDbType.Char).Value = skillRes.uf_purple;
                                cmd.Parameters.Add("@Puf_enemy", SqlDbType.Char).Value = skillRes.uf_enemy;
                                cmd.Parameters.Add("@Ptf_avatar", SqlDbType.Char).Value = skillRes.tf_avatar;
                                cmd.Parameters.Add("@Ptf_summon", SqlDbType.Char).Value = skillRes.tf_summon;
                                cmd.Parameters.Add("@Ptf_monster", SqlDbType.Char).Value = skillRes.tf_monster;
                                cmd.Parameters.Add("@Pskill_lvup_limit", SqlDbType.Char).Value = skillRes.skill_lvup_limit;
                                cmd.Parameters.Add("@Ptarget", SqlDbType.SmallInt).Value = skillRes.target;
                                cmd.Parameters.Add("@Peffect_type", SqlDbType.SmallInt).Value = skillRes.effect_type;
                                cmd.Parameters.Add("@Pskill_enchant_link_id", SqlDbType.Int).Value = skillRes.skill_enchant_link_id;
                                cmd.Parameters.Add("@Pstate_id", SqlDbType.Int).Value = skillRes.state_id;
                                cmd.Parameters.Add("@Pstate_level_base", SqlDbType.Int).Value = skillRes.state_level_base;
                                cmd.Parameters.Add("@Pstate_level_per_skl", SqlDbType.Decimal).Value = skillRes.state_level_per_skl;
                                cmd.Parameters.Add("@Pstate_level_per_enhance", SqlDbType.Decimal).Value = skillRes.state_level_per_enhance;
                                cmd.Parameters.Add("@Pstate_second", SqlDbType.Decimal).Value = skillRes.state_second;
                                cmd.Parameters.Add("@Pstate_second_per_level", SqlDbType.Decimal).Value = skillRes.state_second_per_level;
                                cmd.Parameters.Add("@Pstate_second_per_enhance", SqlDbType.Decimal).Value = skillRes.state_second_per_enhance;
                                cmd.Parameters.Add("@Pprobability_on_hit", SqlDbType.Int).Value = skillRes.probability_on_hit;
                                cmd.Parameters.Add("@Pprobability_inc_by_slv", SqlDbType.Int).Value = skillRes.probability_inc_by_slv;
                                cmd.Parameters.Add("@Phit_bonus", SqlDbType.Int).Value = skillRes.hit_bonus;
                                cmd.Parameters.Add("@Phit_bonus_per_enhance", SqlDbType.SmallInt).Value = skillRes.hit_bonus_per_enhance;
                                cmd.Parameters.Add("@Ppercentage", SqlDbType.SmallInt).Value = skillRes.percentage;
                                cmd.Parameters.Add("@Phate_mod", SqlDbType.Decimal).Value = skillRes.hate_mod;
                                cmd.Parameters.Add("@Phate_basic", SqlDbType.SmallInt).Value = skillRes.hate_basic;
                                cmd.Parameters.Add("@Phate_per_skl", SqlDbType.Decimal).Value = skillRes.hate_per_skl;
                                cmd.Parameters.Add("@Phate_per_enhance", SqlDbType.Decimal).Value = skillRes.hate_per_enhance;
                                cmd.Parameters.Add("@Pcritical_bonus", SqlDbType.Int).Value = skillRes.critical_bonus;
                                cmd.Parameters.Add("@Pcritical_bonus_per_skl", SqlDbType.Int).Value = skillRes.critical_bonus_per_skl;
                                cmd.Parameters.Add("@Pvar1", SqlDbType.Decimal).Value = skillRes.var1;
                                cmd.Parameters.Add("@Pvar2", SqlDbType.Decimal).Value = skillRes.var2;
                                cmd.Parameters.Add("@Pvar3", SqlDbType.Decimal).Value = skillRes.var3;
                                cmd.Parameters.Add("@Pvar4", SqlDbType.Decimal).Value = skillRes.var4;
                                cmd.Parameters.Add("@Pvar5", SqlDbType.Decimal).Value = skillRes.var5;
                                cmd.Parameters.Add("@Pvar6", SqlDbType.Decimal).Value = skillRes.var6;
                                cmd.Parameters.Add("@Pvar7", SqlDbType.Decimal).Value = skillRes.var7;
                                cmd.Parameters.Add("@Pvar8", SqlDbType.Decimal).Value = skillRes.var8;
                                cmd.Parameters.Add("@Pvar9", SqlDbType.Decimal).Value = skillRes.var9;
                                cmd.Parameters.Add("@Pvar10", SqlDbType.Decimal).Value = skillRes.var10;
                                cmd.Parameters.Add("@Pvar11", SqlDbType.Decimal).Value = skillRes.var11;
                                cmd.Parameters.Add("@Pvar12", SqlDbType.Decimal).Value = skillRes.var12;
                                cmd.Parameters.Add("@Pvar13", SqlDbType.Decimal).Value = skillRes.var13;
                                cmd.Parameters.Add("@Pvar14", SqlDbType.Decimal).Value = skillRes.var14;
                                cmd.Parameters.Add("@Pvar15", SqlDbType.Decimal).Value = skillRes.var15;
                                cmd.Parameters.Add("@Pvar16", SqlDbType.Decimal).Value = skillRes.var16;
                                cmd.Parameters.Add("@Pvar17", SqlDbType.Decimal).Value = skillRes.var17;
                                cmd.Parameters.Add("@Pvar18", SqlDbType.Decimal).Value = skillRes.var18;
                                cmd.Parameters.Add("@Pvar19", SqlDbType.Decimal).Value = skillRes.var19;
                                cmd.Parameters.Add("@Pvar20", SqlDbType.Decimal).Value = skillRes.var20;
                                cmd.Parameters.Add("@Picon_id", SqlDbType.Int).Value = skillRes.icon_id;
                                cmd.Parameters.Add("@Picon_file_name", SqlDbType.VarChar).Value = skillRes.icon_file_name;
                                cmd.Parameters.Add("@Pis_projectile", SqlDbType.TinyInt).Value = skillRes.is_projectile;
                                cmd.Parameters.Add("@Pprojectile_speed", SqlDbType.Decimal).Value = skillRes.projectile_speed;
                                cmd.Parameters.Add("@Pprojectile_acceleration", SqlDbType.Decimal).Value = skillRes.projectile_acceleration;
                                cmd.Parameters.Add("@Pjp_01", SqlDbType.Int).Value = skillRes.jp_01;
                                cmd.Parameters.Add("@Pjp_02", SqlDbType.Int).Value = skillRes.jp_02;
                                cmd.Parameters.Add("@Pjp_03", SqlDbType.Int).Value = skillRes.jp_03;
                                cmd.Parameters.Add("@Pjp_04", SqlDbType.Int).Value = skillRes.jp_04;
                                cmd.Parameters.Add("@Pjp_05", SqlDbType.Int).Value = skillRes.jp_05;
                                cmd.Parameters.Add("@Pjp_06", SqlDbType.Int).Value = skillRes.jp_06;
                                cmd.Parameters.Add("@Pjp_07", SqlDbType.Int).Value = skillRes.jp_07;
                                cmd.Parameters.Add("@Pjp_08", SqlDbType.Int).Value = skillRes.jp_08;
                                cmd.Parameters.Add("@Pjp_09", SqlDbType.Int).Value = skillRes.jp_09;
                                cmd.Parameters.Add("@Pjp_10", SqlDbType.Int).Value = skillRes.jp_10;
                                cmd.Parameters.Add("@Pjp_11", SqlDbType.Int).Value = skillRes.jp_11;
                                cmd.Parameters.Add("@Pjp_12", SqlDbType.Int).Value = skillRes.jp_12;
                                cmd.Parameters.Add("@Pjp_13", SqlDbType.Int).Value = skillRes.jp_13;
                                cmd.Parameters.Add("@Pjp_14", SqlDbType.Int).Value = skillRes.jp_14;
                                cmd.Parameters.Add("@Pjp_15", SqlDbType.Int).Value = skillRes.jp_15;
                                cmd.Parameters.Add("@Pjp_16", SqlDbType.Int).Value = skillRes.jp_16;
                                cmd.Parameters.Add("@Pjp_17", SqlDbType.Int).Value = skillRes.jp_17;
                                cmd.Parameters.Add("@Pjp_18", SqlDbType.Int).Value = skillRes.jp_18;
                                cmd.Parameters.Add("@Pjp_19", SqlDbType.Int).Value = skillRes.jp_19;
                                cmd.Parameters.Add("@Pjp_20", SqlDbType.Int).Value = skillRes.jp_20;
                                cmd.Parameters.Add("@Pjp_21", SqlDbType.Int).Value = skillRes.jp_21;
                                cmd.Parameters.Add("@Pjp_22", SqlDbType.Int).Value = skillRes.jp_22;
                                cmd.Parameters.Add("@Pjp_23", SqlDbType.Int).Value = skillRes.jp_23;
                                cmd.Parameters.Add("@Pjp_24", SqlDbType.Int).Value = skillRes.jp_24;
                                cmd.Parameters.Add("@Pjp_25", SqlDbType.Int).Value = skillRes.jp_25;
                                cmd.Parameters.Add("@Pjp_26", SqlDbType.Int).Value = skillRes.jp_26;
                                cmd.Parameters.Add("@Pjp_27", SqlDbType.Int).Value = skillRes.jp_27;
                                cmd.Parameters.Add("@Pjp_28", SqlDbType.Int).Value = skillRes.jp_28;
                                cmd.Parameters.Add("@Pjp_29", SqlDbType.Int).Value = skillRes.jp_29;
                                cmd.Parameters.Add("@Pjp_30", SqlDbType.Int).Value = skillRes.jp_30;
                                cmd.Parameters.Add("@Pjp_31", SqlDbType.Int).Value = skillRes.jp_31;
                                cmd.Parameters.Add("@Pjp_32", SqlDbType.Int).Value = skillRes.jp_32;
                                cmd.Parameters.Add("@Pjp_33", SqlDbType.Int).Value = skillRes.jp_33;
                                cmd.Parameters.Add("@Pjp_34", SqlDbType.Int).Value = skillRes.jp_34;
                                cmd.Parameters.Add("@Pjp_35", SqlDbType.Int).Value = skillRes.jp_35;
                                cmd.Parameters.Add("@Pjp_36", SqlDbType.Int).Value = skillRes.jp_36;
                                cmd.Parameters.Add("@Pjp_37", SqlDbType.Int).Value = skillRes.jp_37;
                                cmd.Parameters.Add("@Pjp_38", SqlDbType.Int).Value = skillRes.jp_38;
                                cmd.Parameters.Add("@Pjp_39", SqlDbType.Int).Value = skillRes.jp_39;
                                cmd.Parameters.Add("@Pjp_40", SqlDbType.Int).Value = skillRes.jp_40;
                                cmd.Parameters.Add("@Pjp_41", SqlDbType.Int).Value = skillRes.jp_41;
                                cmd.Parameters.Add("@Pjp_42", SqlDbType.Int).Value = skillRes.jp_42;
                                cmd.Parameters.Add("@Pjp_43", SqlDbType.Int).Value = skillRes.jp_43;
                                cmd.Parameters.Add("@Pjp_44", SqlDbType.Int).Value = skillRes.jp_44;
                                cmd.Parameters.Add("@Pjp_45", SqlDbType.Int).Value = skillRes.jp_45;
                                cmd.Parameters.Add("@Pjp_46", SqlDbType.Int).Value = skillRes.jp_46;
                                cmd.Parameters.Add("@Pjp_47", SqlDbType.Int).Value = skillRes.jp_47;
                                cmd.Parameters.Add("@Pjp_48", SqlDbType.Int).Value = skillRes.jp_48;
                                cmd.Parameters.Add("@Pjp_49", SqlDbType.Int).Value = skillRes.jp_49;
                                cmd.Parameters.Add("@Pjp_50", SqlDbType.Int).Value = skillRes.jp_50;
                                cmd.ExecuteNonQuery();
                                cmd.Dispose();
                                this.Invoke(new MethodInvoker(delegate { progressBar1.Value++; }));
                            }
                            break;

                        case "SkillResource_73":
                            this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = blSkillResource73.Count; }));
                            new SqlCommand("TRUNCATE TABLE SkillResource", sqlcon).ExecuteNonQuery();
                            new SqlCommand("TRUNCATE TABLE SkillJPResource", sqlcon).ExecuteNonQuery();
                            foreach (SkillResource_73 skillRes73 in blSkillResource73)
                            {
                                SqlCommand cmd = new SqlCommand(skillRes73.ToDatabase(), sqlcon);
                                cmd.Parameters.Clear();
                                cmd.Parameters.Add("@Pid", SqlDbType.Int).Value = skillRes73.id;
                                cmd.Parameters.Add("@Ptext_id", SqlDbType.Int).Value = skillRes73.text_id;
                                cmd.Parameters.Add("@Pdesc_id", SqlDbType.Int).Value = skillRes73.desc_id;
                                cmd.Parameters.Add("@Ptooltip_id", SqlDbType.Int).Value = skillRes73.tooltip_id;
                                cmd.Parameters.Add("@Pis_valid", SqlDbType.TinyInt).Value = skillRes73.is_valid;
                                cmd.Parameters.Add("@Pelemental", SqlDbType.Char).Value = skillRes73.elemental;
                                cmd.Parameters.Add("@Pis_passive", SqlDbType.Char).Value = skillRes73.is_passive;
                                cmd.Parameters.Add("@Pis_physical_act", SqlDbType.Char).Value = skillRes73.is_physical_act;
                                cmd.Parameters.Add("@Pis_harmful", SqlDbType.Char).Value = skillRes73.is_harmful;
                                cmd.Parameters.Add("@Pis_need_target", SqlDbType.Char).Value = skillRes73.is_need_target;
                                cmd.Parameters.Add("@Pis_corpse", SqlDbType.Char).Value = skillRes73.is_corpse;
                                cmd.Parameters.Add("@Pis_toggle", SqlDbType.Char).Value = skillRes73.is_toggle;
                                cmd.Parameters.Add("@Ptoggle_group", SqlDbType.Int).Value = skillRes73.toggle_group;
                                cmd.Parameters.Add("@Pcasting_type", SqlDbType.Char).Value = skillRes73.casting_type;
                                cmd.Parameters.Add("@Pcasting_level", SqlDbType.Char).Value = skillRes73.casting_level;
                                cmd.Parameters.Add("@Pcast_range", SqlDbType.Int).Value = skillRes73.cast_range;
                                cmd.Parameters.Add("@Pvalid_range", SqlDbType.Int).Value = skillRes73.valid_range;
                                cmd.Parameters.Add("@Pcost_hp", SqlDbType.Int).Value = skillRes73.cost_hp;
                                cmd.Parameters.Add("@Pcost_hp_per_skl", SqlDbType.Int).Value = skillRes73.cost_hp_per_skl;
                                cmd.Parameters.Add("@Pcost_mp", SqlDbType.Int).Value = skillRes73.cost_mp;
                                cmd.Parameters.Add("@Pcost_mp_per_skl", SqlDbType.Int).Value = skillRes73.cost_mp_per_skl;
                                cmd.Parameters.Add("@Pcost_mp_per_enhance", SqlDbType.Int).Value = skillRes73.cost_mp_per_enhance;
                                cmd.Parameters.Add("@Pcost_hp_per", SqlDbType.Decimal).Value = skillRes73.cost_hp_per;
                                cmd.Parameters.Add("@Pcost_hp_per_skl_per", SqlDbType.Decimal).Value = skillRes73.cost_hp_per_skl_per;
                                cmd.Parameters.Add("@Pcost_mp_per", SqlDbType.Decimal).Value = skillRes73.cost_mp_per;
                                cmd.Parameters.Add("@Pcost_mp_per_skl_per", SqlDbType.Decimal).Value = skillRes73.cost_mp_per_skl_per;
                                cmd.Parameters.Add("@Pcost_havoc", SqlDbType.Int).Value = skillRes73.cost_havoc;
                                cmd.Parameters.Add("@Pcost_havoc_per_skl", SqlDbType.Int).Value = skillRes73.cost_havoc_per_skl;
                                cmd.Parameters.Add("@Pcost_energy", SqlDbType.Decimal).Value = skillRes73.cost_energy;
                                cmd.Parameters.Add("@Pcost_energy_per_skl", SqlDbType.Decimal).Value = skillRes73.cost_energy_per_skl;
                                cmd.Parameters.Add("@Pcost_exp", SqlDbType.Int).Value = skillRes73.cost_exp;
                                cmd.Parameters.Add("@Pcost_exp_per_enhance", SqlDbType.Int).Value = skillRes73.cost_exp_per_enhance;
                                cmd.Parameters.Add("@Pcost_jp", SqlDbType.Int).Value = skillRes73.cost_jp;
                                cmd.Parameters.Add("@Pcost_jp_per_enhance", SqlDbType.Int).Value = skillRes73.cost_jp_per_enhance;
                                cmd.Parameters.Add("@Pcost_item", SqlDbType.Int).Value = skillRes73.cost_item;
                                cmd.Parameters.Add("@Pcost_item_count", SqlDbType.Int).Value = skillRes73.cost_item_count;
                                cmd.Parameters.Add("@Pcost_item_count_per_skl", SqlDbType.Int).Value = skillRes73.cost_item_count_per_skl;
                                cmd.Parameters.Add("@Pneed_level", SqlDbType.Int).Value = skillRes73.need_level;
                                cmd.Parameters.Add("@Pneed_hp", SqlDbType.Int).Value = skillRes73.need_hp;
                                cmd.Parameters.Add("@Pneed_mp", SqlDbType.Int).Value = skillRes73.need_mp;
                                cmd.Parameters.Add("@Pneed_havoc", SqlDbType.Int).Value = skillRes73.need_havoc;
                                cmd.Parameters.Add("@Pneed_havoc_burst", SqlDbType.Int).Value = skillRes73.need_havoc_burst;
                                cmd.Parameters.Add("@Pneed_state_id", SqlDbType.Int).Value = skillRes73.need_state_id;
                                cmd.Parameters.Add("@Pneed_state_level", SqlDbType.TinyInt).Value = skillRes73.need_state_level;
                                cmd.Parameters.Add("@Pneed_state_exhaust", SqlDbType.TinyInt).Value = skillRes73.need_state_exhaust;
                                cmd.Parameters.Add("@Pvf_one_hand_sword", SqlDbType.Char).Value = skillRes73.vf_one_hand_sword;
                                cmd.Parameters.Add("@Pvf_two_hand_sword", SqlDbType.Char).Value = skillRes73.vf_two_hand_sword;
                                cmd.Parameters.Add("@Pvf_double_sword", SqlDbType.Char).Value = skillRes73.vf_double_sword;
                                cmd.Parameters.Add("@Pvf_dagger", SqlDbType.Char).Value = skillRes73.vf_dagger;
                                cmd.Parameters.Add("@Pvf_double_dagger", SqlDbType.Char).Value = skillRes73.vf_double_dagger;
                                cmd.Parameters.Add("@Pvf_spear", SqlDbType.Char).Value = skillRes73.vf_spear;
                                cmd.Parameters.Add("@Pvf_axe", SqlDbType.Char).Value = skillRes73.vf_axe;
                                cmd.Parameters.Add("@Pvf_one_hand_axe", SqlDbType.Char).Value = skillRes73.vf_one_hand_axe;
                                cmd.Parameters.Add("@Pvf_double_axe", SqlDbType.Char).Value = skillRes73.vf_double_axe;
                                cmd.Parameters.Add("@Pvf_one_hand_mace", SqlDbType.Char).Value = skillRes73.vf_one_hand_mace;
                                cmd.Parameters.Add("@Pvf_two_hand_mace", SqlDbType.Char).Value = skillRes73.vf_two_hand_mace;
                                cmd.Parameters.Add("@Pvf_lightbow", SqlDbType.Char).Value = skillRes73.vf_lightbow;
                                cmd.Parameters.Add("@Pvf_heavybow", SqlDbType.Char).Value = skillRes73.vf_heavybow;
                                cmd.Parameters.Add("@Pvf_crossbow", SqlDbType.Char).Value = skillRes73.vf_crossbow;
                                cmd.Parameters.Add("@Pvf_one_hand_staff", SqlDbType.Char).Value = skillRes73.vf_one_hand_staff;
                                cmd.Parameters.Add("@Pvf_two_hand_staff", SqlDbType.Char).Value = skillRes73.vf_two_hand_staff;
                                cmd.Parameters.Add("@Pvf_shield_only", SqlDbType.Char).Value = skillRes73.vf_shield_only;
                                cmd.Parameters.Add("@Pvf_is_not_need_weapon", SqlDbType.Char).Value = skillRes73.vf_is_not_need_weapon;
                                cmd.Parameters.Add("@Pdelay_cast", SqlDbType.Decimal).Value = skillRes73.delay_cast;
                                cmd.Parameters.Add("@Pdelay_cast_per_skl", SqlDbType.Decimal).Value = skillRes73.delay_cast_per_skl;
                                cmd.Parameters.Add("@Pdelay_cast_mode_per_enhance", SqlDbType.Decimal).Value = skillRes73.delay_cast_mode_per_enhance;
                                cmd.Parameters.Add("@Pdelay_common", SqlDbType.Decimal).Value = skillRes73.delay_common;
                                cmd.Parameters.Add("@Pdelay_cooltime", SqlDbType.Decimal).Value = skillRes73.delay_cooltime;
                                cmd.Parameters.Add("@Pdelay_cooltime_per_skl", SqlDbType.Decimal).Value = skillRes73.delay_cooltime_per_skl;
                                cmd.Parameters.Add("@Pdelay_cooltime_mode_per_enhance", SqlDbType.Decimal).Value = skillRes73.delay_cooltime_mode_per_enhance;
                                cmd.Parameters.Add("@Pcool_time_group_id", SqlDbType.Int).Value = skillRes73.cool_time_group_id;
                                cmd.Parameters.Add("@Puf_self", SqlDbType.Char).Value = skillRes73.uf_self;
                                cmd.Parameters.Add("@Puf_party", SqlDbType.Char).Value = skillRes73.uf_party;
                                cmd.Parameters.Add("@Puf_guild", SqlDbType.Char).Value = skillRes73.uf_guild;
                                cmd.Parameters.Add("@Puf_neutral", SqlDbType.Char).Value = skillRes73.uf_neutral;
                                cmd.Parameters.Add("@Puf_purple", SqlDbType.Char).Value = skillRes73.uf_purple;
                                cmd.Parameters.Add("@Puf_enemy", SqlDbType.Char).Value = skillRes73.uf_enemy;
                                cmd.Parameters.Add("@Ptf_avatar", SqlDbType.Char).Value = skillRes73.tf_avatar;
                                cmd.Parameters.Add("@Ptf_summon", SqlDbType.Char).Value = skillRes73.tf_summon;
                                cmd.Parameters.Add("@Ptf_monster", SqlDbType.Char).Value = skillRes73.tf_monster;
                                cmd.Parameters.Add("@Pskill_lvup_limit", SqlDbType.Char).Value = skillRes73.skill_lvup_limit;
                                cmd.Parameters.Add("@Ptarget", SqlDbType.SmallInt).Value = skillRes73.target;
                                cmd.Parameters.Add("@Peffect_type", SqlDbType.SmallInt).Value = skillRes73.effect_type;
                                cmd.Parameters.Add("@Pskill_enchant_link_id", SqlDbType.Int).Value = skillRes73.skill_enchant_link_id;
                                cmd.Parameters.Add("@Pstate_id", SqlDbType.Int).Value = skillRes73.state_id;
                                cmd.Parameters.Add("@Pstate_level_base", SqlDbType.Int).Value = skillRes73.state_level_base;
                                cmd.Parameters.Add("@Pstate_level_per_skl", SqlDbType.Decimal).Value = skillRes73.state_level_per_skl;
                                cmd.Parameters.Add("@Pstate_level_per_enhance", SqlDbType.Decimal).Value = skillRes73.state_level_per_enhance;
                                cmd.Parameters.Add("@Pstate_second", SqlDbType.Decimal).Value = skillRes73.state_second;
                                cmd.Parameters.Add("@Pstate_second_per_level", SqlDbType.Decimal).Value = skillRes73.state_second_per_level;
                                cmd.Parameters.Add("@Pstate_second_per_enhance", SqlDbType.Decimal).Value = skillRes73.state_second_per_enhance;
                                cmd.Parameters.Add("@Pprobability_on_hit", SqlDbType.Int).Value = skillRes73.probability_on_hit;
                                cmd.Parameters.Add("@Pprobability_inc_by_slv", SqlDbType.Int).Value = skillRes73.probability_inc_by_slv;
                                cmd.Parameters.Add("@Phit_bonus", SqlDbType.Int).Value = skillRes73.hit_bonus;
                                cmd.Parameters.Add("@Phit_bonus_per_enhance", SqlDbType.SmallInt).Value = skillRes73.hit_bonus_per_enhance;
                                cmd.Parameters.Add("@Ppercentage", SqlDbType.SmallInt).Value = skillRes73.percentage;
                                cmd.Parameters.Add("@Phate_mod", SqlDbType.Decimal).Value = skillRes73.hate_mod;
                                cmd.Parameters.Add("@Phate_basic", SqlDbType.SmallInt).Value = skillRes73.hate_basic;
                                cmd.Parameters.Add("@Phate_per_skl", SqlDbType.Decimal).Value = skillRes73.hate_per_skl;
                                cmd.Parameters.Add("@Phate_per_enhance", SqlDbType.Decimal).Value = skillRes73.hate_per_enhance;
                                cmd.Parameters.Add("@Pcritical_bonus", SqlDbType.Int).Value = skillRes73.critical_bonus;
                                cmd.Parameters.Add("@Pcritical_bonus_per_skl", SqlDbType.Int).Value = skillRes73.critical_bonus_per_skl;
                                cmd.Parameters.Add("@Pvar1", SqlDbType.Decimal).Value = skillRes73.var1;
                                cmd.Parameters.Add("@Pvar2", SqlDbType.Decimal).Value = skillRes73.var2;
                                cmd.Parameters.Add("@Pvar3", SqlDbType.Decimal).Value = skillRes73.var3;
                                cmd.Parameters.Add("@Pvar4", SqlDbType.Decimal).Value = skillRes73.var4;
                                cmd.Parameters.Add("@Pvar5", SqlDbType.Decimal).Value = skillRes73.var5;
                                cmd.Parameters.Add("@Pvar6", SqlDbType.Decimal).Value = skillRes73.var6;
                                cmd.Parameters.Add("@Pvar7", SqlDbType.Decimal).Value = skillRes73.var7;
                                cmd.Parameters.Add("@Pvar8", SqlDbType.Decimal).Value = skillRes73.var8;
                                cmd.Parameters.Add("@Pvar9", SqlDbType.Decimal).Value = skillRes73.var9;
                                cmd.Parameters.Add("@Pvar10", SqlDbType.Decimal).Value = skillRes73.var10;
                                cmd.Parameters.Add("@Pvar11", SqlDbType.Decimal).Value = skillRes73.var11;
                                cmd.Parameters.Add("@Pvar12", SqlDbType.Decimal).Value = skillRes73.var12;
                                cmd.Parameters.Add("@Pvar13", SqlDbType.Decimal).Value = skillRes73.var13;
                                cmd.Parameters.Add("@Pvar14", SqlDbType.Decimal).Value = skillRes73.var14;
                                cmd.Parameters.Add("@Pvar15", SqlDbType.Decimal).Value = skillRes73.var15;
                                cmd.Parameters.Add("@Pvar16", SqlDbType.Decimal).Value = skillRes73.var16;
                                cmd.Parameters.Add("@Pvar17", SqlDbType.Decimal).Value = skillRes73.var17;
                                cmd.Parameters.Add("@Pvar18", SqlDbType.Decimal).Value = skillRes73.var18;
                                cmd.Parameters.Add("@Pvar19", SqlDbType.Decimal).Value = skillRes73.var19;
                                cmd.Parameters.Add("@Pvar20", SqlDbType.Decimal).Value = skillRes73.var20;
                                cmd.Parameters.Add("@Picon_id", SqlDbType.Int).Value = skillRes73.icon_id;
                                cmd.Parameters.Add("@Picon_file_name", SqlDbType.VarChar).Value = skillRes73.icon_file_name;
                                cmd.Parameters.Add("@Pis_projectile", SqlDbType.TinyInt).Value = skillRes73.is_projectile;
                                cmd.Parameters.Add("@Pprojectile_speed", SqlDbType.Decimal).Value = skillRes73.projectile_speed;
                                cmd.Parameters.Add("@Pprojectile_acceleration", SqlDbType.Decimal).Value = skillRes73.projectile_acceleration;
                                cmd.Parameters.Add("@Pjp_01", SqlDbType.Int).Value = skillRes73.jp_01;
                                cmd.Parameters.Add("@Pjp_02", SqlDbType.Int).Value = skillRes73.jp_02;
                                cmd.Parameters.Add("@Pjp_03", SqlDbType.Int).Value = skillRes73.jp_03;
                                cmd.Parameters.Add("@Pjp_04", SqlDbType.Int).Value = skillRes73.jp_04;
                                cmd.Parameters.Add("@Pjp_05", SqlDbType.Int).Value = skillRes73.jp_05;
                                cmd.Parameters.Add("@Pjp_06", SqlDbType.Int).Value = skillRes73.jp_06;
                                cmd.Parameters.Add("@Pjp_07", SqlDbType.Int).Value = skillRes73.jp_07;
                                cmd.Parameters.Add("@Pjp_08", SqlDbType.Int).Value = skillRes73.jp_08;
                                cmd.Parameters.Add("@Pjp_09", SqlDbType.Int).Value = skillRes73.jp_09;
                                cmd.Parameters.Add("@Pjp_10", SqlDbType.Int).Value = skillRes73.jp_10;
                                cmd.Parameters.Add("@Pjp_11", SqlDbType.Int).Value = skillRes73.jp_11;
                                cmd.Parameters.Add("@Pjp_12", SqlDbType.Int).Value = skillRes73.jp_12;
                                cmd.Parameters.Add("@Pjp_13", SqlDbType.Int).Value = skillRes73.jp_13;
                                cmd.Parameters.Add("@Pjp_14", SqlDbType.Int).Value = skillRes73.jp_14;
                                cmd.Parameters.Add("@Pjp_15", SqlDbType.Int).Value = skillRes73.jp_15;
                                cmd.Parameters.Add("@Pjp_16", SqlDbType.Int).Value = skillRes73.jp_16;
                                cmd.Parameters.Add("@Pjp_17", SqlDbType.Int).Value = skillRes73.jp_17;
                                cmd.Parameters.Add("@Pjp_18", SqlDbType.Int).Value = skillRes73.jp_18;
                                cmd.Parameters.Add("@Pjp_19", SqlDbType.Int).Value = skillRes73.jp_19;
                                cmd.Parameters.Add("@Pjp_20", SqlDbType.Int).Value = skillRes73.jp_20;
                                cmd.Parameters.Add("@Pjp_21", SqlDbType.Int).Value = skillRes73.jp_21;
                                cmd.Parameters.Add("@Pjp_22", SqlDbType.Int).Value = skillRes73.jp_22;
                                cmd.Parameters.Add("@Pjp_23", SqlDbType.Int).Value = skillRes73.jp_23;
                                cmd.Parameters.Add("@Pjp_24", SqlDbType.Int).Value = skillRes73.jp_24;
                                cmd.Parameters.Add("@Pjp_25", SqlDbType.Int).Value = skillRes73.jp_25;
                                cmd.Parameters.Add("@Pjp_26", SqlDbType.Int).Value = skillRes73.jp_26;
                                cmd.Parameters.Add("@Pjp_27", SqlDbType.Int).Value = skillRes73.jp_27;
                                cmd.Parameters.Add("@Pjp_28", SqlDbType.Int).Value = skillRes73.jp_28;
                                cmd.Parameters.Add("@Pjp_29", SqlDbType.Int).Value = skillRes73.jp_29;
                                cmd.Parameters.Add("@Pjp_30", SqlDbType.Int).Value = skillRes73.jp_30;
                                cmd.Parameters.Add("@Pjp_31", SqlDbType.Int).Value = skillRes73.jp_31;
                                cmd.Parameters.Add("@Pjp_32", SqlDbType.Int).Value = skillRes73.jp_32;
                                cmd.Parameters.Add("@Pjp_33", SqlDbType.Int).Value = skillRes73.jp_33;
                                cmd.Parameters.Add("@Pjp_34", SqlDbType.Int).Value = skillRes73.jp_34;
                                cmd.Parameters.Add("@Pjp_35", SqlDbType.Int).Value = skillRes73.jp_35;
                                cmd.Parameters.Add("@Pjp_36", SqlDbType.Int).Value = skillRes73.jp_36;
                                cmd.Parameters.Add("@Pjp_37", SqlDbType.Int).Value = skillRes73.jp_37;
                                cmd.Parameters.Add("@Pjp_38", SqlDbType.Int).Value = skillRes73.jp_38;
                                cmd.Parameters.Add("@Pjp_39", SqlDbType.Int).Value = skillRes73.jp_39;
                                cmd.Parameters.Add("@Pjp_40", SqlDbType.Int).Value = skillRes73.jp_40;
                                cmd.Parameters.Add("@Pjp_41", SqlDbType.Int).Value = skillRes73.jp_41;
                                cmd.Parameters.Add("@Pjp_42", SqlDbType.Int).Value = skillRes73.jp_42;
                                cmd.Parameters.Add("@Pjp_43", SqlDbType.Int).Value = skillRes73.jp_43;
                                cmd.Parameters.Add("@Pjp_44", SqlDbType.Int).Value = skillRes73.jp_44;
                                cmd.Parameters.Add("@Pjp_45", SqlDbType.Int).Value = skillRes73.jp_45;
                                cmd.Parameters.Add("@Pjp_46", SqlDbType.Int).Value = skillRes73.jp_46;
                                cmd.Parameters.Add("@Pjp_47", SqlDbType.Int).Value = skillRes73.jp_47;
                                cmd.Parameters.Add("@Pjp_48", SqlDbType.Int).Value = skillRes73.jp_48;
                                cmd.Parameters.Add("@Pjp_49", SqlDbType.Int).Value = skillRes73.jp_49;
                                cmd.Parameters.Add("@Pjp_50", SqlDbType.Int).Value = skillRes73.jp_50;
                                cmd.ExecuteNonQuery();
                                cmd.Dispose();
                                this.Invoke(new MethodInvoker(delegate { progressBar1.Value++; }));
                            }
                            break;

                        case "SkillStage":
                            this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = blSkillStage.Count; }));
                            new SqlCommand("TRUNCATE TABLE SkillStage", sqlcon).ExecuteNonQuery();
                            foreach (SkillStage skillstageRes in blSkillStage)
                            {
                                SqlCommand cmd = new SqlCommand(skillstageRes.ToDatabase(), sqlcon);
                                cmd.Parameters.Clear();
                                cmd.Parameters.Add("@Pid", SqlDbType.Int).Value = skillstageRes.id;
                                cmd.Parameters.Add("@Pelemental", SqlDbType.Char).Value = skillstageRes.elemental;
                                cmd.Parameters.Add("@Ptype", SqlDbType.Char).Value = skillstageRes.type;
                                cmd.Parameters.Add("@Pdeal_damage", SqlDbType.Char).Value = skillstageRes.deal_damage;
                                cmd.Parameters.Add("@Phas_target", SqlDbType.Char).Value = skillstageRes.has_target;
                                cmd.Parameters.Add("@Pcorpse_target", SqlDbType.Char).Value = skillstageRes.corpse_target;
                                cmd.Parameters.Add("@Pis_toggle", SqlDbType.Char).Value = skillstageRes.is_toggle;
                                cmd.Parameters.Add("@Pcasting_time", SqlDbType.Decimal).Value = skillstageRes.casting_time;
                                cmd.Parameters.Add("@Pis_creature_skill", SqlDbType.Char).Value = skillstageRes.is_creature_skill;
                                cmd.Parameters.Add("@Pstage_type_id", SqlDbType.Int).Value = skillstageRes.stage_type_id;
                                cmd.Parameters.Add("@Pcasting_type_id", SqlDbType.Int).Value = skillstageRes.casting_type_id;
                                cmd.Parameters.Add("@Pcasting_start_motion_id", SqlDbType.Int).Value = skillstageRes.casting_start_motion_id;
                                cmd.Parameters.Add("@Pcasting_middle_motion_id", SqlDbType.Int).Value = skillstageRes.casting_middle_motion_id;
                                cmd.Parameters.Add("@Pcasting_fx_set_id", SqlDbType.Int).Value = skillstageRes.casting_fx_set_id;
                                cmd.Parameters.Add("@Pfire_motion_id", SqlDbType.Int).Value = skillstageRes.fire_motion_id;
                                cmd.Parameters.Add("@Pfire_fx_set_id", SqlDbType.Int).Value = skillstageRes.fire_fx_set_id;
                                cmd.Parameters.Add("@Pstage_data_01", SqlDbType.Decimal).Value = skillstageRes.stage_data_01;
                                cmd.Parameters.Add("@Pstage_data_02", SqlDbType.Decimal).Value = skillstageRes.stage_data_02;
                                cmd.Parameters.Add("@Pstage_data_03", SqlDbType.Decimal).Value = skillstageRes.stage_data_03;
                                cmd.Parameters.Add("@Pstage_data_04", SqlDbType.Decimal).Value = skillstageRes.stage_data_04;
                                cmd.Parameters.Add("@Pstage_data_05", SqlDbType.Decimal).Value = skillstageRes.stage_data_05;
                                cmd.Parameters.Add("@Pstage_data_06", SqlDbType.Decimal).Value = skillstageRes.stage_data_06;
                                cmd.Parameters.Add("@Pstage_data_07", SqlDbType.Decimal).Value = skillstageRes.stage_data_07;
                                cmd.Parameters.Add("@Pstage_data_08", SqlDbType.Decimal).Value = skillstageRes.stage_data_08;
                                cmd.Parameters.Add("@Pstage_data_09", SqlDbType.Decimal).Value = skillstageRes.stage_data_09;
                                cmd.Parameters.Add("@Pstage_data_10", SqlDbType.Decimal).Value = skillstageRes.stage_data_10;
                                cmd.Parameters.Add("@Pstage_data_11", SqlDbType.Decimal).Value = skillstageRes.stage_data_11;
                                cmd.Parameters.Add("@Pstage_data_12", SqlDbType.Decimal).Value = skillstageRes.stage_data_12;
                                cmd.Parameters.Add("@Pstage_data_13", SqlDbType.Decimal).Value = skillstageRes.stage_data_13;
                                cmd.Parameters.Add("@Pstage_data_14", SqlDbType.Decimal).Value = skillstageRes.stage_data_14;
                                cmd.Parameters.Add("@Pstage_data_15", SqlDbType.Decimal).Value = skillstageRes.stage_data_15;
                                cmd.Parameters.Add("@Pstage_data_16", SqlDbType.Decimal).Value = skillstageRes.stage_data_16;
                                cmd.Parameters.Add("@Pstage_data_17", SqlDbType.Decimal).Value = skillstageRes.stage_data_17;
                                cmd.Parameters.Add("@Pstage_data_18", SqlDbType.Decimal).Value = skillstageRes.stage_data_18;
                                cmd.Parameters.Add("@Pstage_data_19", SqlDbType.Decimal).Value = skillstageRes.stage_data_19;
                                cmd.Parameters.Add("@Pstage_data_20", SqlDbType.Decimal).Value = skillstageRes.stage_data_20;
                                cmd.Parameters.Add("@Psub_stage_on_hit_id", SqlDbType.Int).Value = skillstageRes.sub_stage_on_hit_id;
                                cmd.Parameters.Add("@Psub_stage_on_hit_continuous", SqlDbType.Int).Value = skillstageRes.sub_stage_on_hit_continuous;
                                cmd.Parameters.Add("@Phit_fx_output_delay", SqlDbType.Int).Value = skillstageRes.hit_fx_output_delay;
                                cmd.Parameters.Add("@Phit_fx_set_id", SqlDbType.Int).Value = skillstageRes.hit_fx_set_id;
                                cmd.Parameters.Add("@Phit_fx_set_position_id", SqlDbType.Int).Value = skillstageRes.hit_fx_set_position_id;
                                cmd.Parameters.Add("@Pfire_fx_output_delay", SqlDbType.Int).Value = skillstageRes.fire_fx_output_delay;
                                cmd.Parameters.Add("@Psub_fire_fx_set_id", SqlDbType.Int).Value = skillstageRes.sub_fire_fx_set_id;
                                cmd.Parameters.Add("@Psub_fire_fx_position", SqlDbType.Int).Value = skillstageRes.sub_fire_fx_position;
                                cmd.ExecuteNonQuery();
                                cmd.Dispose();
                                this.Invoke(new MethodInvoker(delegate { progressBar1.Value++; }));
                            }
                            break;

                        case "SkillTreeDisplay":
                            this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = blSkillTreeDisplay.Count; }));
                            new SqlCommand("TRUNCATE TABLE  SkillTreeDisplay", sqlcon).ExecuteNonQuery();
                            foreach (SkillTreeDisplay skilltreedisRes in blSkillTreeDisplay)
                            {
                                SqlCommand cmd = new SqlCommand(skilltreedisRes.ToDatabase(), sqlcon);
                                cmd.Parameters.Clear();
                                cmd.Parameters.Add("@Pjob_id", SqlDbType.Int).Value = skilltreedisRes.job_id;
                                cmd.Parameters.Add("@Pslot_v", SqlDbType.Int).Value = skilltreedisRes.slot_v;
                                cmd.Parameters.Add("@Pskill1_id", SqlDbType.Int).Value = skilltreedisRes.skill1_id;
                                cmd.Parameters.Add("@Pskill2_id", SqlDbType.Int).Value = skilltreedisRes.skill2_id;
                                cmd.Parameters.Add("@Pskill3_id", SqlDbType.Int).Value = skilltreedisRes.skill3_id;
                                cmd.Parameters.Add("@Pskill4_id", SqlDbType.Int).Value = skilltreedisRes.skill4_id;
                                cmd.Parameters.Add("@Pskill5_id", SqlDbType.Int).Value = skilltreedisRes.skill5_id;
                                cmd.ExecuteNonQuery();
                                cmd.Dispose();
                                this.Invoke(new MethodInvoker(delegate { progressBar1.Value++; }));
                            }
                            break;

                        case "SkillTreeResource":
                            this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = blSkillTreeResource.Count; }));
                            new SqlCommand("TRUNCATE TABLE SkillTreeResource", sqlcon).ExecuteNonQuery();
                            foreach (SkillTreeResource skilltreeRes in blSkillTreeResource)
                            {
                                SqlCommand cmd = new SqlCommand(skilltreeRes.ToDatabase(), sqlcon);
                                cmd.Parameters.Clear();
                                cmd.Parameters.Add("@Pjob_id", SqlDbType.Int).Value = skilltreeRes.job_id;
                                cmd.Parameters.Add("@Pskill_id", SqlDbType.Int).Value = skilltreeRes.skill_id;
                                cmd.Parameters.Add("@Pmin_skill_lv", SqlDbType.Int).Value = skilltreeRes.min_skill_lv;
                                cmd.Parameters.Add("@Pmax_skill_lv", SqlDbType.Int).Value = skilltreeRes.max_skill_lv;
                                cmd.Parameters.Add("@Plv", SqlDbType.Int).Value = skilltreeRes.lv;
                                cmd.Parameters.Add("@Pjob_lv", SqlDbType.Int).Value = skilltreeRes.job_lv;
                                cmd.Parameters.Add("@Pjp_ratio", SqlDbType.Decimal).Value = skilltreeRes.jp_ratio;
                                cmd.Parameters.Add("@Pneed_skill_id_1", SqlDbType.Int).Value = skilltreeRes.need_skill_id_1;
                                cmd.Parameters.Add("@Pneed_skill_lv_1", SqlDbType.Int).Value = skilltreeRes.need_skill_lv_1;
                                cmd.Parameters.Add("@Pneed_skill_id_2", SqlDbType.Int).Value = skilltreeRes.need_skill_id_2;
                                cmd.Parameters.Add("@Pneed_skill_lv_2", SqlDbType.Int).Value = skilltreeRes.need_skill_lv_2;
                                cmd.Parameters.Add("@Pneed_skill_id_3", SqlDbType.Int).Value = skilltreeRes.need_skill_id_3;
                                cmd.Parameters.Add("@Pneed_skill_lv_3", SqlDbType.Int).Value = skilltreeRes.need_skill_lv_3;
                                cmd.Parameters.Add("@Pcenhance_min", SqlDbType.Int).Value = skilltreeRes.cenhance_min;
                                cmd.Parameters.Add("@Pcenhance_max", SqlDbType.Int).Value = skilltreeRes.cenhance_max;
                                cmd.ExecuteNonQuery();
                                cmd.Dispose();
                                this.Invoke(new MethodInvoker(delegate { progressBar1.Value++; }));
                            }
                            break;

                        case "SkillTreeResource_82":
                            this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = blSkillTreeResource_82.Count; }));
                            new SqlCommand("TRUNCATE TABLE SkillTreeResource", sqlcon).ExecuteNonQuery();
                            foreach (SkillTreeResource_82 skilltreeRes82 in blSkillTreeResource_82)
                            {
                                SqlCommand cmd = new SqlCommand(skilltreeRes82.ToDatabase(), sqlcon);
                                cmd.Parameters.Clear();
                                cmd.Parameters.Add("@job_id", SqlDbType.Int).Value = skilltreeRes82.job_id;
                                cmd.Parameters.Add("@skill_id", SqlDbType.Int).Value = skilltreeRes82.skill_id;
                                cmd.Parameters.Add("@min_skill_lv", SqlDbType.Int).Value = skilltreeRes82.min_skill_lv;
                                cmd.Parameters.Add("@max_skill_lv", SqlDbType.Int).Value = skilltreeRes82.max_skill_lv;
                                cmd.Parameters.Add("@lv", SqlDbType.Int).Value = skilltreeRes82.lv;
                                cmd.Parameters.Add("@job_lv", SqlDbType.Int).Value = skilltreeRes82.job_lv;
                                cmd.Parameters.Add("@jp_ratio", SqlDbType.Decimal).Value = skilltreeRes82.jp_ratio;
                                cmd.Parameters.Add("@need_skill_id_1", SqlDbType.Int).Value = skilltreeRes82.need_skill_id_1;
                                cmd.Parameters.Add("@need_skill_lv_1", SqlDbType.Int).Value = skilltreeRes82.need_skill_lv_1;
                                cmd.Parameters.Add("@need_skill_id_2", SqlDbType.Int).Value = skilltreeRes82.need_skill_id_2;
                                cmd.Parameters.Add("@need_skill_lv_2", SqlDbType.Int).Value = skilltreeRes82.need_skill_lv_2;
                                cmd.Parameters.Add("@need_skill_id_3", SqlDbType.Int).Value = skilltreeRes82.need_skill_id_3;
                                cmd.Parameters.Add("@need_skill_lv_3", SqlDbType.Int).Value = skilltreeRes82.need_skill_lv_3;
                                cmd.Parameters.Add("@cenhance_min", SqlDbType.Int).Value = skilltreeRes82.cenhance_min;
                                cmd.Parameters.Add("@cenhance_max", SqlDbType.Int).Value = skilltreeRes82.cenhance_max;
                                cmd.ExecuteNonQuery();
                                cmd.Dispose();
                                this.Invoke(new MethodInvoker(delegate { progressBar1.Value++; }));
                            }
                            break;

                        case "StateResource":
                            this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = blStateResource.Count; }));
                            new SqlCommand("TRUNCATE TABLE StateResource", sqlcon).ExecuteNonQuery();
                            foreach (StateResource stateRes in blStateResource)
                            {
                                SqlCommand cmd = new SqlCommand(stateRes.ToDatabase(), sqlcon);
                                cmd.Parameters.Clear();
                                cmd.Parameters.Add("@Pstate_id", SqlDbType.Int).Value = stateRes.state_id;
                                cmd.Parameters.Add("@Ptext_id", SqlDbType.Int).Value = stateRes.text_id;
                                cmd.Parameters.Add("@Ptooltip_id", SqlDbType.Int).Value = stateRes.tooltip_id;
                                cmd.Parameters.Add("@Pis_harmful", SqlDbType.Char).Value = stateRes.is_harmful;
                                cmd.Parameters.Add("@Pstate_time_type", SqlDbType.Int).Value = stateRes.state_time_type;
                                cmd.Parameters.Add("@Pstate_group", SqlDbType.Int).Value = stateRes.state_group;
                                cmd.Parameters.Add("@Pduplicate_group_1", SqlDbType.Int).Value = stateRes.duplicate_group_1;
                                cmd.Parameters.Add("@Pduplicate_group_2", SqlDbType.Int).Value = stateRes.duplicate_group_2;
                                cmd.Parameters.Add("@Pduplicate_group_3", SqlDbType.Int).Value = stateRes.duplicate_group_3;
                                cmd.Parameters.Add("@Puf_avatar", SqlDbType.Char).Value = stateRes.uf_avatar;
                                cmd.Parameters.Add("@Puf_summon", SqlDbType.Char).Value = stateRes.uf_summon;
                                cmd.Parameters.Add("@Puf_monster", SqlDbType.Char).Value = stateRes.uf_monster;
                                cmd.Parameters.Add("@Preiteration_count", SqlDbType.SmallInt).Value = stateRes.reiteration_count;
                                cmd.Parameters.Add("@Pbase_effect_id", SqlDbType.Int).Value = stateRes.base_effect_id;
                                cmd.Parameters.Add("@Pfire_interval", SqlDbType.Int).Value = stateRes.fire_interval;
                                cmd.Parameters.Add("@Pelemental_type", SqlDbType.Int).Value = stateRes.elemental_type;
                                cmd.Parameters.Add("@Pamplify_base", SqlDbType.Decimal).Value = stateRes.amplify_base;
                                cmd.Parameters.Add("@Pamplify_per_skl", SqlDbType.Decimal).Value = stateRes.amplify_per_skl;
                                cmd.Parameters.Add("@Padd_damage_base", SqlDbType.Int).Value = stateRes.add_damage_base;
                                cmd.Parameters.Add("@Padd_damage_per_skl", SqlDbType.Int).Value = stateRes.add_damage_per_skl;
                                cmd.Parameters.Add("@Peffect_type", SqlDbType.Int).Value = stateRes.effect_type;
                                cmd.Parameters.Add("@Pvalue_0", SqlDbType.Decimal).Value = stateRes.value_0;
                                cmd.Parameters.Add("@Pvalue_1", SqlDbType.Decimal).Value = stateRes.value_1;
                                cmd.Parameters.Add("@Pvalue_2", SqlDbType.Decimal).Value = stateRes.value_2;
                                cmd.Parameters.Add("@Pvalue_3", SqlDbType.Decimal).Value = stateRes.value_3;
                                cmd.Parameters.Add("@Pvalue_4", SqlDbType.Decimal).Value = stateRes.value_4;
                                cmd.Parameters.Add("@Pvalue_5", SqlDbType.Decimal).Value = stateRes.value_5;
                                cmd.Parameters.Add("@Pvalue_6", SqlDbType.Decimal).Value = stateRes.value_6;
                                cmd.Parameters.Add("@Pvalue_7", SqlDbType.Decimal).Value = stateRes.value_7;
                                cmd.Parameters.Add("@Pvalue_8", SqlDbType.Decimal).Value = stateRes.value_8;
                                cmd.Parameters.Add("@Pvalue_9", SqlDbType.Decimal).Value = stateRes.value_9;
                                cmd.Parameters.Add("@Pvalue_10", SqlDbType.Decimal).Value = stateRes.value_10;
                                cmd.Parameters.Add("@Pvalue_11", SqlDbType.Decimal).Value = stateRes.value_11;
                                cmd.Parameters.Add("@Pvalue_12", SqlDbType.Decimal).Value = stateRes.value_12;
                                cmd.Parameters.Add("@Pvalue_13", SqlDbType.Decimal).Value = stateRes.value_13;
                                cmd.Parameters.Add("@Pvalue_14", SqlDbType.Decimal).Value = stateRes.value_14;
                                cmd.Parameters.Add("@Pvalue_15", SqlDbType.Decimal).Value = stateRes.value_15;
                                cmd.Parameters.Add("@Pvalue_16", SqlDbType.Decimal).Value = stateRes.value_16;
                                cmd.Parameters.Add("@Pvalue_17", SqlDbType.Decimal).Value = stateRes.value_17;
                                cmd.Parameters.Add("@Pvalue_18", SqlDbType.Decimal).Value = stateRes.value_18;
                                cmd.Parameters.Add("@Pvalue_19", SqlDbType.Decimal).Value = stateRes.value_19;
                                cmd.Parameters.Add("@Picon_id", SqlDbType.Int).Value = stateRes.icon_id;
                                cmd.Parameters.Add("@Picon_file_name", SqlDbType.VarChar).Value = stateRes.icon_file_name;
                                cmd.Parameters.Add("@Pfx_id", SqlDbType.Int).Value = stateRes.fx_id;
                                cmd.Parameters.Add("@Ppos_id", SqlDbType.Int).Value = stateRes.pos_id;
                                cmd.Parameters.Add("@Pcast_skill_id", SqlDbType.Int).Value = stateRes.cast_skill_id;
                                cmd.Parameters.Add("@Pcast_fx_id", SqlDbType.Int).Value = stateRes.cast_fx_id;
                                cmd.Parameters.Add("@Pcast_fx_pos_id", SqlDbType.Int).Value = stateRes.cast_fx_pos_id;
                                cmd.Parameters.Add("@Phit_fx_id", SqlDbType.Int).Value = stateRes.hit_fx_id;
                                cmd.Parameters.Add("@Phit_fx_pos_id", SqlDbType.Int).Value = stateRes.hit_fx_pos_id;
                                cmd.Parameters.Add("@Pspecial_output_timing_id", SqlDbType.Int).Value = stateRes.special_output_timing_id;
                                cmd.Parameters.Add("@Pspecial_output_fx_id", SqlDbType.Int).Value = stateRes.special_output_fx_id;
                                cmd.Parameters.Add("@Pspecial_output_fx_pos_id", SqlDbType.Int).Value = stateRes.special_output_fx_pos_id;
                                cmd.Parameters.Add("@Pspecial_output_fx_delay", SqlDbType.Int).Value = stateRes.special_output_fx_delay;
                                cmd.Parameters.Add("@Pstate_fx_id", SqlDbType.Int).Value = stateRes.state_fx_id;
                                cmd.Parameters.Add("@Pstate_fx_pos_id", SqlDbType.Int).Value = stateRes.state_fx_pos_id;
                                cmd.ExecuteNonQuery();
                                cmd.Dispose();
                                this.Invoke(new MethodInvoker(delegate { progressBar1.Value++; }));
                            }
                            break;

                        case "StatResource":
                            this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = blStatResource.Count; }));
                            new SqlCommand("TRUNCATE TABLE StatResource", sqlcon).ExecuteNonQuery();
                            foreach (StatResource statRes in blStatResource)
                            {
                                SqlCommand cmd = new SqlCommand(statRes.ToDatabase(), sqlcon);
                                cmd.Parameters.Clear();
                                cmd.Parameters.Add("@Pid", SqlDbType.Int).Value = statRes.id;
                                cmd.Parameters.Add("@Pstr", SqlDbType.Int).Value = statRes.str;
                                cmd.Parameters.Add("@Pvit", SqlDbType.Int).Value = statRes.vit;
                                cmd.Parameters.Add("@Pdex", SqlDbType.Int).Value = statRes.dex;
                                cmd.Parameters.Add("@Pagi", SqlDbType.Int).Value = statRes.agi;
                                cmd.Parameters.Add("@Pint", SqlDbType.Int).Value = statRes.Int;
                                cmd.Parameters.Add("@Pmen", SqlDbType.Int).Value = statRes.men;
                                cmd.Parameters.Add("@Pluk", SqlDbType.Int).Value = statRes.luk;
                                cmd.ExecuteNonQuery();
                                cmd.Dispose();
                                this.Invoke(new MethodInvoker(delegate { progressBar1.Value++; }));
                            }
                            break;

                        case "SummonResource_82":
                            this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = blSummonResource_82.Count; }));
                            new SqlCommand("TRUNCATE TABLE SummonResource", sqlcon).ExecuteNonQuery();
                            foreach (SummonResource_82 summonRes82 in blSummonResource_82)
                            {
                                SqlCommand cmd = new SqlCommand(summonRes82.ToDatabase(), sqlcon);
                                cmd.Parameters.Clear();
                                cmd.Parameters.Add("@id", SqlDbType.Int).Value = summonRes82.id;
                                cmd.Parameters.Add("@model_id", SqlDbType.Int).Value = summonRes82.model_id;
                                cmd.Parameters.Add("@name_id", SqlDbType.Int).Value = summonRes82.name_id;
                                cmd.Parameters.Add("@type", SqlDbType.Int).Value = summonRes82.type;
                                cmd.Parameters.Add("@magic_type", SqlDbType.Int).Value = summonRes82.magic_type;
                                cmd.Parameters.Add("@rate", SqlDbType.TinyInt).Value = summonRes82.rate;
                                cmd.Parameters.Add("@stat_id", SqlDbType.Int).Value = summonRes82.stat_id;
                                cmd.Parameters.Add("@size", SqlDbType.Decimal).Value = summonRes82.size;
                                cmd.Parameters.Add("@scale", SqlDbType.Decimal).Value = summonRes82.scale;
                                cmd.Parameters.Add("@target_fx_size", SqlDbType.Decimal).Value = summonRes82.target_fx_size;
                                cmd.Parameters.Add("@standard_walk_speed", SqlDbType.Int).Value = summonRes82.standard_walk_speed;
                                cmd.Parameters.Add("@standard_run_speed", SqlDbType.Int).Value = summonRes82.standard_run_speed;
                                cmd.Parameters.Add("@riding_speed", SqlDbType.Int).Value = summonRes82.riding_speed;
                                cmd.Parameters.Add("@run_speed", SqlDbType.Int).Value = summonRes82.run_speed;
                                cmd.Parameters.Add("@is_riding_only", SqlDbType.Int).Value = summonRes82.is_riding_only;
                                cmd.Parameters.Add("@riding_motion_type", SqlDbType.Int).Value = summonRes82.riding_motion_type;
                                cmd.Parameters.Add("@attack_range",  SqlDbType.Decimal).Value = summonRes82.attack_range;
                                cmd.Parameters.Add("@walk_type", SqlDbType.Int).Value = summonRes82.walk_type;
                                cmd.Parameters.Add("@slant_type", SqlDbType.Int).Value = summonRes82.slant_type;
                                cmd.Parameters.Add("@material", SqlDbType.Int).Value = summonRes82.material;
                                cmd.Parameters.Add("@weapon_type", SqlDbType.Int).Value = summonRes82.weapon_type;
                                cmd.Parameters.Add("@attack_motion_speed", SqlDbType.Int).Value = summonRes82.attack_motion_speed;
                                cmd.Parameters.Add("@form", SqlDbType.Int).Value = summonRes82.form;
                                cmd.Parameters.Add("@evolve_target", SqlDbType.Int).Value = summonRes82.evolve_target;
                                cmd.Parameters.Add("@camera_x", SqlDbType.Int).Value = summonRes82.camera_x;
                                cmd.Parameters.Add("@camera_y", SqlDbType.Int).Value = summonRes82.camera_y;
                                cmd.Parameters.Add("@camera_z", SqlDbType.Int).Value = summonRes82.camera_z;
                                cmd.Parameters.Add("@target_x", SqlDbType.Int).Value = summonRes82.target_x;
                                cmd.Parameters.Add("@target_y", SqlDbType.Int).Value = summonRes82.target_y;
                                cmd.Parameters.Add("@target_z", SqlDbType.Int).Value = summonRes82.target_z;
                                cmd.Parameters.Add("@model", SqlDbType.VarChar).Value = summonRes82.model;
                                cmd.Parameters.Add("@motion_file_id", SqlDbType.Int).Value = summonRes82.motion_file_id;
                                cmd.Parameters.Add("@face_id", SqlDbType.Int).Value = summonRes82.face_id;
                                cmd.Parameters.Add("@face_file_name", SqlDbType.VarChar).Value = summonRes82.face_file_name;
                                cmd.Parameters.Add("@card_id", SqlDbType.Int).Value = summonRes82.card_id;
                                cmd.Parameters.Add("@script_text", SqlDbType.VarChar).Value = "";
                                cmd.Parameters.Add("@illust_file_name", SqlDbType.VarChar).Value = summonRes82.illust_file_name;
                                cmd.Parameters.Add("@text_feature_id", SqlDbType.Int).Value = summonRes82.text_feature_id;
                                cmd.Parameters.Add("@text_name_id", SqlDbType.Int).Value = summonRes82.text_name_id;
                                cmd.Parameters.Add("@skill1_id", SqlDbType.Int).Value = summonRes82.skill1_id;
                                cmd.Parameters.Add("@skill1_text_id", SqlDbType.Int).Value = summonRes82.skill1_text_id;
                                cmd.Parameters.Add("@skill2_id", SqlDbType.Int).Value = summonRes82.skill2_id;
                                cmd.Parameters.Add("@skill2_text_id", SqlDbType.Int).Value = summonRes82.skill2_text_id;
                                cmd.Parameters.Add("@skill3_id", SqlDbType.Int).Value = summonRes82.skill3_id;
                                cmd.Parameters.Add("@skill3_text_id", SqlDbType.Int).Value = summonRes82.skill3_text_id;
                                cmd.Parameters.Add("@skill4_id", SqlDbType.Int).Value = summonRes82.skill4_id;
                                cmd.Parameters.Add("@skill4_text_id", SqlDbType.Int).Value = summonRes82.skill4_text_id;
                                cmd.Parameters.Add("@skill5_id", SqlDbType.Int).Value = summonRes82.skill5_id;
                                cmd.Parameters.Add("@skill5_text_id", SqlDbType.Int).Value = summonRes82.skill5_text_id;
                                cmd.Parameters.Add("@texture_group", SqlDbType.Int).Value = summonRes82.texture_group;
                                cmd.Parameters.Add("@local_flag", SqlDbType.Int).Value = summonRes82.local_flag;
                                cmd.ExecuteNonQuery();
                                cmd.Dispose();
                                this.Invoke(new MethodInvoker(delegate { progressBar1.Value++; }));
                            }
                            break;

                        case "StringResource":
                            this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = blStringResource.Count; }));
                            new SqlCommand("TRUNCATE TABLE StringResource", sqlcon).ExecuteNonQuery();
                            foreach (StringResource stringRes in blStringResource)
                            {
                                SqlCommand cmd = new SqlCommand(stringRes.ToDatabase(), sqlcon);
                                cmd.Parameters.Clear();
                                cmd.Parameters.Add("@Pname", SqlDbType.VarChar).Value = stringRes.name;
                                cmd.Parameters.Add("@Pgroup_id", SqlDbType.Int).Value = stringRes.group_id;
                                cmd.Parameters.Add("@Pcode", SqlDbType.Int).Value = stringRes.code;
                                cmd.Parameters.Add("@Pvalue", SqlDbType.VarChar).Value = stringRes.value;
                                cmd.ExecuteNonQuery();
                                cmd.Dispose();
                                this.Invoke(new MethodInvoker(delegate { progressBar1.Value++; }));
                            }
                            break;

                        case "WorldLocation": 
                            this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = blWorldLocation.Count; }));
                            new SqlCommand("TRUNCATE TABLE WorldLocation", sqlcon).ExecuteNonQuery();
                            foreach (WorldLocation worldLocation in blWorldLocation)
                            {
                                SqlCommand cmd = new SqlCommand(worldLocation.ToDatabase(), sqlcon);
                                cmd.Parameters.Clear();
                                cmd.Parameters.Add("@id", SqlDbType.Int).Value = worldLocation.id;
                                cmd.Parameters.Add("@text_id", SqlDbType.Int).Value = worldLocation.text_id;
                                cmd.Parameters.Add("@x", SqlDbType.Int).Value = worldLocation.x;
                                cmd.Parameters.Add("@y", SqlDbType.Int).Value = worldLocation.y;
                                cmd.Parameters.Add("@preloading_distance", SqlDbType.Int).Value = worldLocation.preloading_distance;
                                cmd.Parameters.Add("@apply_location_name", SqlDbType.Int).Value = worldLocation.apply_location_name;
                                cmd.Parameters.Add("@apply_light", SqlDbType.Int).Value = worldLocation.apply_light;
                                cmd.Parameters.Add("@apply_bgm", SqlDbType.Int).Value = worldLocation.apply_bgm;
                                cmd.Parameters.Add("@location_type", SqlDbType.Int).Value = worldLocation.location_type;
                                cmd.Parameters.Add("@fog_application", SqlDbType.Int).Value = worldLocation.fog_application;
                                cmd.Parameters.Add("@time_id", SqlDbType.Int).Value = worldLocation.time_id;
                                cmd.Parameters.Add("@weather_id", SqlDbType.Int).Value = worldLocation.weather_id;
                                cmd.Parameters.Add("@cloud_ratio", SqlDbType.Int).Value = worldLocation.cloud_ratio;
                                cmd.Parameters.Add("@weather_change_time", SqlDbType.Int).Value = worldLocation.weather_change_time;
                                cmd.Parameters.Add("@weather_ratio", SqlDbType.Int).Value = worldLocation.weather_ratio;
                                cmd.Parameters.Add("@sky_start_a", SqlDbType.Int).Value = worldLocation.sky_start_a;
                                cmd.Parameters.Add("@sky_start_r", SqlDbType.Int).Value = worldLocation.sky_start_r;
                                cmd.Parameters.Add("@sky_start_g", SqlDbType.Int).Value = worldLocation.sky_start_g;
                                cmd.Parameters.Add("@sky_start_b", SqlDbType.Int).Value = worldLocation.sky_start_b;
                                cmd.Parameters.Add("@sky_mid_a", SqlDbType.Int).Value = worldLocation.sky_mid_a;
                                cmd.Parameters.Add("@sky_mid_r", SqlDbType.Int).Value = worldLocation.sky_mid_r;
                                cmd.Parameters.Add("@sky_mid_g", SqlDbType.Int).Value = worldLocation.sky_mid_g;
                                cmd.Parameters.Add("@sky_mid_b", SqlDbType.Int).Value = worldLocation.sky_mid_b;
                                cmd.Parameters.Add("@sky_end_a", SqlDbType.Int).Value = worldLocation.sky_end_a;
                                cmd.Parameters.Add("@sky_end_r", SqlDbType.Int).Value = worldLocation.sky_end_r;
                                cmd.Parameters.Add("@sky_end_g", SqlDbType.Int).Value = worldLocation.sky_end_g;
                                cmd.Parameters.Add("@sky_end_b", SqlDbType.Int).Value = worldLocation.sky_end_b;
                                cmd.Parameters.Add("@sky_mid_rate", SqlDbType.Float).Value = worldLocation.sky_mid_rate;
                                cmd.Parameters.Add("@diffuse_a", SqlDbType.Int).Value = worldLocation.diffuse_a;
                                cmd.Parameters.Add("@diffuse_r", SqlDbType.Int).Value = worldLocation.diffuse_r;
                                cmd.Parameters.Add("@diffuse_g", SqlDbType.Int).Value = worldLocation.diffuse_g;
                                cmd.Parameters.Add("@diffuse_b", SqlDbType.Int).Value = worldLocation.diffuse_b;
                                cmd.Parameters.Add("@ambient_a", SqlDbType.Int).Value = worldLocation.ambient_a;
                                cmd.Parameters.Add("@ambient_r", SqlDbType.Int).Value = worldLocation.ambient_r;
                                cmd.Parameters.Add("@ambient_g", SqlDbType.Int).Value = worldLocation.ambient_g;
                                cmd.Parameters.Add("@ambient_b", SqlDbType.Int).Value = worldLocation.ambient_b;
                                cmd.Parameters.Add("@specular_a", SqlDbType.Int).Value = worldLocation.specular_a;
                                cmd.Parameters.Add("@specular_r", SqlDbType.Int).Value = worldLocation.specular_r;
                                cmd.Parameters.Add("@specular_g", SqlDbType.Int).Value = worldLocation.specular_g;
                                cmd.Parameters.Add("@specular_b", SqlDbType.Int).Value = worldLocation.specular_b;
                                cmd.Parameters.Add("@fog_a", SqlDbType.Int).Value = worldLocation.fog_a;
                                cmd.Parameters.Add("@fog_r", SqlDbType.Int).Value = worldLocation.fog_r;
                                cmd.Parameters.Add("@fog_g", SqlDbType.Int).Value = worldLocation.fog_g;
                                cmd.Parameters.Add("@fog_b", SqlDbType.Int).Value = worldLocation.fog_b;
                                cmd.Parameters.Add("@v_start", SqlDbType.Float).Value = worldLocation.v_start;
                                cmd.Parameters.Add("@v_end", SqlDbType.Float).Value = worldLocation.v_end;
                                cmd.Parameters.Add("@h_start", SqlDbType.Float).Value = worldLocation.h_start;
                                cmd.Parameters.Add("@h_end", SqlDbType.Float).Value = worldLocation.h_end;
                                cmd.Parameters.Add("@fixed_terrain_distance", SqlDbType.Int).Value = worldLocation.fixed_terrain_distance;
                                cmd.Parameters.Add("@cloud_a", SqlDbType.Int).Value = worldLocation.cloud_a;
                                cmd.Parameters.Add("@cloud_r", SqlDbType.Int).Value = worldLocation.cloud_r;
                                cmd.Parameters.Add("@cloud_g", SqlDbType.Int).Value = worldLocation.cloud_g;
                                cmd.Parameters.Add("@cloud_b", SqlDbType.Int).Value = worldLocation.cloud_b;
                                cmd.Parameters.Add("@land_specular", SqlDbType.Float).Value = worldLocation.land_specular;
                                cmd.Parameters.Add("@character_diffuse", SqlDbType.Float).Value = worldLocation.character_diffuse;
                                cmd.Parameters.Add("@character_ambient", SqlDbType.Float).Value = worldLocation.character_ambient;
                                cmd.Parameters.Add("@sun_texture_file", SqlDbType.Int).Value = worldLocation.sun_texture_file;
                                cmd.Parameters.Add("@moon_texture_file", SqlDbType.Int).Value = worldLocation.moon_texture_file;
                                cmd.Parameters.Add("@cloud_texture_file", SqlDbType.Int).Value = worldLocation.cloud_texture_file;
                                cmd.Parameters.Add("@bgm1_ID", SqlDbType.Int).Value = worldLocation.bgm1_ID;
                                cmd.Parameters.Add("@bgm2_ID", SqlDbType.Int).Value = worldLocation.bgm2_ID;
                                cmd.Parameters.Add("@bgm3_ID", SqlDbType.Int).Value = worldLocation.bgm3_ID;
                                cmd.Parameters.Add("@bgm1_ratio", SqlDbType.Int).Value = worldLocation.bgm1_ratio;
                                cmd.Parameters.Add("@bgm2_ratio", SqlDbType.Int).Value = worldLocation.bgm2_ratio;
                                cmd.Parameters.Add("@bgm3_ratio", SqlDbType.Int).Value = worldLocation.bgm3_ratio;
                                cmd.Parameters.Add("@enviromental_sound1_ID", SqlDbType.Int).Value = worldLocation.environmental_sound1_ID;
                                cmd.Parameters.Add("@environmental_sound2_ID", SqlDbType.Int).Value = worldLocation.environmental_sound2_ID;
                                cmd.Parameters.Add("@environmental_sound3_ID", SqlDbType.Int).Value = worldLocation.environmental_sound3_ID;
                                cmd.Parameters.Add("@environmental_sound4_ID", SqlDbType.Int).Value = worldLocation.environmental_sound4_ID;
                                cmd.Parameters.Add("@environmental_sound1_ratio", SqlDbType.Int).Value = worldLocation.environmental_sound1_ratio;
                                cmd.Parameters.Add("@environmental_sound2_ratio", SqlDbType.Int).Value = worldLocation.environmental_sound2_ratio;
                                cmd.Parameters.Add("@environmental_sound3_ratio", SqlDbType.Int).Value = worldLocation.environmental_sound3_ratio;
                                cmd.Parameters.Add("@environmental_sound4_ratio", SqlDbType.Int).Value = worldLocation.environmental_sound4_ratio;
                                cmd.Parameters.Add("@enviromental_sound_reverb", SqlDbType.Int).Value = worldLocation.environmental_sound_reverb;
                                cmd.Parameters.Add("@enviromental_sound_volume", SqlDbType.Int).Value = worldLocation.environmental_sound_volume;
                                cmd.Parameters.Add("@enviromental_sound_equalizer", SqlDbType.Int).Value = worldLocation.environmental_sound_equalizer;
                                cmd.Parameters.Add("@minimap_ani_file_ID", SqlDbType.Int).Value = worldLocation.minimap_ani_file_ID;
                                cmd.Parameters.Add("@worldmap_ani_file_ID", SqlDbType.Int).Value = worldLocation.worldmap_ani_file_ID;
                                cmd.Parameters.Add("@zoom_map_type", SqlDbType.Int).Value = worldLocation.zoom_map_type;
                                cmd.Parameters.Add("@display_positoin_x", SqlDbType.Int).Value = worldLocation.display_positoin_x;
                                cmd.Parameters.Add("@display_positoin_y", SqlDbType.Int).Value = worldLocation.display_positoin_y;
                                cmd.Parameters.Add("@zoom_x", SqlDbType.Int).Value = worldLocation.zoom_x;
                                cmd.Parameters.Add("@offset_x", SqlDbType.Int).Value = worldLocation.offset_x;
                                cmd.Parameters.Add("@offset_y", SqlDbType.Int).Value = worldLocation.offset_y;
                                cmd.Parameters.Add("@size_x", SqlDbType.Int).Value = worldLocation.size_x;
                                cmd.Parameters.Add("@size_y", SqlDbType.Int).Value = worldLocation.size_y;
                                cmd.Parameters.Add("@blank_resource_ID", SqlDbType.Int).Value = worldLocation.blank_resource_ID;
                                cmd.Parameters.Add("@blank_a", SqlDbType.Int).Value = worldLocation.blank_a;
                                cmd.Parameters.Add("@blank_r", SqlDbType.Int).Value = worldLocation.blank_r;
                                cmd.Parameters.Add("@blank_g", SqlDbType.Int).Value = worldLocation.blank_g;
                                cmd.Parameters.Add("@blank_b", SqlDbType.Int).Value = worldLocation.blank_b;
                                cmd.Parameters.Add("@zoom_minimap", SqlDbType.Int).Value = worldLocation.zoom_minimap;
                                cmd.Parameters.Add("@precipitation_min", SqlDbType.Int).Value = worldLocation.precipitation_min;
                                cmd.Parameters.Add("@precipitation_max", SqlDbType.Int).Value = worldLocation.precipitation_max;
                                cmd.Parameters.Add("@aurora_t", SqlDbType.Int).Value = worldLocation.aurora_t;
                                cmd.Parameters.Add("@aurora_a", SqlDbType.Int).Value = worldLocation.aurora_a;
                                cmd.Parameters.Add("@aurora_s", SqlDbType.Int).Value = worldLocation.aurora_s;
                                cmd.Parameters.Add("@aurora_h", SqlDbType.Int).Value = worldLocation.aurora_h;
                                cmd.ExecuteNonQuery();
                                cmd.Dispose();
                                this.Invoke(new MethodInvoker(delegate { progressBar1.Value++; }));
                            }
                            break;

                    }
                    sqlcon.Close();
                    sqlcon.Dispose();
                }
            }
            catch (Exception ext_box)
            {
                MessageBox.Show(ext_box.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }

        private void Load_RDB_DB_Worker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            this.Invoke(new MethodInvoker(delegate { blStringResource.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blFieldPropResource.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blQuestResource.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blQuestResource73.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blItemResource.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blSummonResource.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blSummonResource_82.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blMonsterMotionSet.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blEffectResource.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blModelEffectResource.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blPetResource.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blPetResource73.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blPetResource_82.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blSkillResource.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blSkillResource73.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blSkillTreeDisplay.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blSkillTreeResource.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blSkillTreeResource_82.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blSkillStage.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blStateResource.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blItemEffectResource.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blMonsterResource.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blStatResource.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blJobResource.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blWorldLocation.Clear(); }));
            this.Invoke(new MethodInvoker(delegate { blWorldLocation73.Clear(); }));

            try
            {
                string connect = string.Format("Data Source={0};Initial Catalog={1};User Id={2};Password={3};", OPT.GetString("db.server"), OPT.GetString("db.name"), OPT.GetString("db.account"), SFM.GetDecryptMD5(OPT.GetString("db.password")));
                using (SqlConnection sqlcon = new SqlConnection(connect))
                {
                    string selected_rdb = "";
                    string database_name = "";

                    this.Invoke(new MethodInvoker(delegate { selected_rdb = cbSelect.Text; }));
                    ///////////////////////////////////////////
                    //Begin _XX FIX
                    //If the selected rdb name ends with _XX
                    //We must remove it for fetching the MAX COUNT
                    if (selected_rdb.ToString() == "SkillResource_73")
                    {
                        database_name = "SkillResource";
                    }
                    else if (selected_rdb.ToString() == "WorldLocation_73")
                    {
                        database_name = "WorldLocation";
                    }
                    else if (selected_rdb.ToString() == "PetResource_73")
                    {
                        database_name = "PetResource";
                    }
                    else if (selected_rdb.ToString() == "QuestResource_73")
                    {
                        database_name = "QuestResource";
                    }
                    else
                    {
                        database_name = selected_rdb;
                    }
                    //////////////////////////////////////////
                    //////////////////////////////////////////
                    try
                    {
                        sqlcon.Open();
                        this.Invoke(new MethodInvoker(delegate { progressBar1.Value = 0; }));
                        SqlDataReader tbCount = new SqlCommand("SELECT COUNT(*) FROM " + database_name, sqlcon).ExecuteReader();
                        tbCount.Read();
                        this.Invoke(new MethodInvoker(delegate { progressBar1.Maximum = int.Parse(tbCount[0].ToString()) + 1; }));
                        tbCount.Close();
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("Damn! I have failed to fetch sql row count!\nContact acre_development@gmail.com and provide the following error code\nError Code: sql_max_err", "Exception Raised", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }

                    switch (selected_rdb)
                    {
                        case "EffectResource":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blEffectResource; }));
                            using (SqlDataReader drExecute = new SqlCommand(EffectResource.FromDatabase(), sqlcon).ExecuteReader())
                            {
                                while (drExecute.Read())
                                {
                                    EffectResource effectRes = new EffectResource();
                                    effectRes.FromDatabaseExecute(drExecute);
                                    this.Invoke(new MethodInvoker(delegate { blEffectResource.Add(effectRes); }));
                                    this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                                }
                            }
                            break;

                        case "FieldPropResource":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blFieldPropResource; }));
                            using (SqlDataReader drExecute = new SqlCommand(FieldPropResource.FromDatabase(), sqlcon).ExecuteReader())
                            {
                                while (drExecute.Read())
                                {
                                    FieldPropResource fieldpropRes = new FieldPropResource();
                                    fieldpropRes.FromDatabaseExecute(drExecute);
                                    this.Invoke(new MethodInvoker(delegate { blFieldPropResource.Add(fieldpropRes); }));
                                    this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                                }
                            }
                            break;

                        case "ItemEffectResource":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blItemEffectResource; }));
                            using (SqlDataReader drExecute = new SqlCommand(ItemEffectResource.FromDatabase(), sqlcon).ExecuteReader())
                            {
                                while (drExecute.Read())
                                {
                                    ItemEffectResource itemeffectRes = new ItemEffectResource();
                                    itemeffectRes.FromDatabaseExecute(drExecute);
                                    this.Invoke(new MethodInvoker(delegate { blItemEffectResource.Add(itemeffectRes); }));
                                    this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                                }
                            }
                            break;

                        case "ItemResource":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blItemResource; }));
                            using (SqlDataReader drExecute = new SqlCommand(ItemResource.FromDatabase(), sqlcon).ExecuteReader())
                            {
                                while (drExecute.Read())
                                {
                                    ItemResource itemRes = new ItemResource();
                                    itemRes.FromDatabaseExecute(drExecute);
                                    this.Invoke(new MethodInvoker(delegate { blItemResource.Add(itemRes); }));
                                    this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                                }
                            }
                            break;

                        case "JobResource":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blJobResource; }));
                            using (SqlDataReader drExecute = new SqlCommand(JobResource.FromDatabase(), sqlcon).ExecuteReader())
                            {
                                while (drExecute.Read())
                                {
                                    JobResource jobRes = new JobResource();
                                    jobRes.FromDatabaseExecute(drExecute);
                                    this.Invoke(new MethodInvoker(delegate { blJobResource.Add(jobRes); }));
                                    this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                                }
                            }
                            break;

                        case "MixResource":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blMixResource; }));
                            using (SqlDataReader drExecute = new SqlCommand(MixResource.FromDatabase(), sqlcon).ExecuteReader())
                            {
                                while (drExecute.Read())
                                {
                                    MixResource mixRes = new MixResource();
                                    mixRes.FromDatabaseExecute(drExecute);
                                    this.Invoke(new MethodInvoker(delegate { blMixResource.Add(mixRes); }));
                                    this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                                }
                            }
                            break;

                        case "ModelEffectResource":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blModelEffectResource; }));
                            using (SqlDataReader drExecute = new SqlCommand(ModelEffectResource.FromDatabase(), sqlcon).ExecuteReader())
                            {
                                while (drExecute.Read())
                                {
                                    ModelEffectResource modeleffectRes = new ModelEffectResource();
                                    modeleffectRes.FromDatabaseExecute(drExecute);
                                    this.Invoke(new MethodInvoker(delegate { blModelEffectResource.Add(modeleffectRes); }));
                                    this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                                }
                            }
                            break;

                        case "MonsterMotionSet":
                            this.Invoke(new MethodInvoker(delegate { blMonsterMotionSet.Clear(); }));
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blMonsterMotionSet; }));
                            using (SqlDataReader drExecute = new SqlCommand(MonsterMotionSet.FromDatabase(), sqlcon).ExecuteReader())
                            {
                                while (drExecute.Read())
                                {
                                    MonsterMotionSet motionRes = new MonsterMotionSet();
                                    motionRes.FromDatabaseExecute(drExecute);
                                    this.Invoke(new MethodInvoker(delegate { blMonsterMotionSet.Add(motionRes); }));
                                    this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                                }
                            }
                            break;

                        case "MonsterResource":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blMonsterResource; }));
                            using (SqlDataReader drExecute = new SqlCommand(MonsterResource.FromDatabase(), sqlcon).ExecuteReader())
                            {
                                while (drExecute.Read())
                                {
                                    MonsterResource mobRes = new MonsterResource();
                                    mobRes.FromDatabaseExecute(drExecute);
                                    this.Invoke(new MethodInvoker(delegate { blMonsterResource.Add(mobRes); }));
                                    this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                                }
                            }
                            break;

                        case "NPCResource":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blNPCResource; }));
                            using (SqlDataReader drExecute = new SqlCommand(NPCResource.FromDatabase(), sqlcon).ExecuteReader())
                            {
                                while (drExecute.Read())
                                {
                                    NPCResource npcRes = new NPCResource();
                                    npcRes.FromDatabaseExecute(drExecute);
                                    this.Invoke(new MethodInvoker(delegate { blNPCResource.Add(npcRes); }));
                                    this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                                }
                            }
                            break;

                        case "PetResource":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blPetResource; }));
                            using (SqlDataReader drExecute = new SqlCommand(PetResource.FromDatabase(), sqlcon).ExecuteReader())
                            {
                                while (drExecute.Read())
                                {
                                    PetResource petRes = new PetResource();
                                    petRes.FromDatabaseExecute(drExecute);
                                    this.Invoke(new MethodInvoker(delegate { blPetResource.Add(petRes); }));
                                    this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                                }
                            }
                            break;

                        case "PetResource_73":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blPetResource73; }));
                            using (SqlDataReader drExecute = new SqlCommand(PetResource_73.FromDatabase(), sqlcon).ExecuteReader())
                            {
                                while (drExecute.Read())
                                {
                                    PetResource_73 petRes73 = new PetResource_73();
                                    petRes73.FromDatabaseExecute(drExecute);
                                    this.Invoke(new MethodInvoker(delegate { blPetResource73.Add(petRes73); }));
                                    this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                                }
                            }
                            break;

                        case "QuestLinkResource":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blQuestLinkResource; }));
                            using (SqlDataReader drExecute = new SqlCommand(QuestLinkResource.FromDatabase(), sqlcon).ExecuteReader())
                            {
                                while (drExecute.Read())
                                {
                                    QuestLinkResource linkRes = new QuestLinkResource();
                                    linkRes.FromDatabaseExecute(drExecute);
                                    this.Invoke(new MethodInvoker(delegate { blQuestLinkResource.Add(linkRes); }));
                                    this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                                }
                            }
                            break;

                        case "QuestResource":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blQuestResource; }));
                            using (SqlDataReader drExecute = new SqlCommand(QuestResource.FromDatabase(), sqlcon).ExecuteReader())
                            {
                                while (drExecute.Read())
                                {
                                    QuestResource questRes = new QuestResource();
                                    questRes.FromDatabaseExecute(drExecute);
                                    this.Invoke(new MethodInvoker(delegate { blQuestResource.Add(questRes); }));
                                    this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                                }
                            }
                            break;

                        case "QuestResource_73":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blQuestResource73; }));
                            using (SqlDataReader drExecute = new SqlCommand(QuestResource.FromDatabase(), sqlcon).ExecuteReader())
                            {
                                while (drExecute.Read())
                                {
                                    QuestResource_73 questRes73 = new QuestResource_73();
                                    questRes73.FromDatabaseExecute(drExecute);
                                    this.Invoke(new MethodInvoker(delegate { blQuestResource73.Add(questRes73); }));
                                    this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                                }
                            }
                            break;

                        case "SkillResource":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blSkillResource; }));
                            using (SqlDataReader drExecute = new SqlCommand(SkillResource.FromDatabase(), sqlcon).ExecuteReader())
                            {
                                while (drExecute.Read())
                                {
                                    SkillResource skillRes = new SkillResource();
                                    skillRes.FromDatabaseExecute(drExecute);
                                    this.Invoke(new MethodInvoker(delegate { blSkillResource.Add(skillRes); }));
                                    this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                                }
                            }
                            break;

                        case "SkillResource_73":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blSkillResource73; }));
                            using (SqlDataReader drExecute = new SqlCommand(SkillResource_73.FromDatabase(), sqlcon).ExecuteReader())
                            {
                                while (drExecute.Read())
                                {
                                    SkillResource_73 skillRes73 = new SkillResource_73();
                                    skillRes73.FromDatabaseExecute(drExecute);
                                    this.Invoke(new MethodInvoker(delegate { blSkillResource73.Add(skillRes73); }));
                                    this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                                }
                            }
                            break;

                        case "SkillStage":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blSkillStage; }));
                            using (SqlDataReader drExecute = new SqlCommand(SkillStage.FromDatabase(), sqlcon).ExecuteReader())
                            {
                                while (drExecute.Read())
                                {
                                    SkillStage skillstageRes = new SkillStage();
                                    skillstageRes.FromDatabaseExecute(drExecute);
                                    this.Invoke(new MethodInvoker(delegate { blSkillStage.Add(skillstageRes); }));
                                    this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                                }
                            }
                            break;

                        case "SkillTreeDisplay":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blSkillTreeDisplay; }));
                            using (SqlDataReader drExecute = new SqlCommand(SkillTreeDisplay.FromDatabase(), sqlcon).ExecuteReader())
                            {
                                while (drExecute.Read())
                                {
                                    SkillTreeDisplay skilltreedisplayRes = new SkillTreeDisplay();
                                    skilltreedisplayRes.FromDatabaseExecute(drExecute);
                                    this.Invoke(new MethodInvoker(delegate { blSkillTreeDisplay.Add(skilltreedisplayRes); }));
                                    this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                                }
                            }
                            break;

                        case "SkillTreeResource":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blSkillTreeResource; }));
                            using (SqlDataReader drExecute = new SqlCommand(SkillTreeResource.FromDatabase(), sqlcon).ExecuteReader())
                            {
                                while (drExecute.Read())
                                {
                                    SkillTreeResource skilltreeRes = new SkillTreeResource();
                                    skilltreeRes.FromDatabaseExecute(drExecute);
                                    this.Invoke(new MethodInvoker(delegate { blSkillTreeResource.Add(skilltreeRes); }));
                                    this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                                }
                            }
                            break;

                        case "StateResource":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blStateResource; }));
                            using (SqlDataReader drExecute = new SqlCommand(StateResource.FromDatabase(), sqlcon).ExecuteReader())
                            {
                                while (drExecute.Read())
                                {
                                    StateResource stateRes = new StateResource();
                                    stateRes.FromDatabaseExecute(drExecute);
                                    this.Invoke(new MethodInvoker(delegate { blStateResource.Add(stateRes); }));
                                    this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                                }
                            }
                            break;

                        case "StatResource":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blStatResource; }));
                            using (SqlDataReader drExecute = new SqlCommand(StatResource.FromDatabase(), sqlcon).ExecuteReader())
                            {
                                while (drExecute.Read())
                                {
                                    StatResource statRes = new StatResource();
                                    statRes.FromDatabaseExecute(drExecute);
                                    this.Invoke(new MethodInvoker(delegate { blStatResource.Add(statRes); }));
                                    this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                                }
                            }
                            break;

                        case "StringResource":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blStringResource; }));
                            using (SqlDataReader drExecute = new SqlCommand(StringResource.FromDatabase(), sqlcon).ExecuteReader())
                            {
                                while (drExecute.Read())
                                {
                                    StringResource stringRes = new StringResource();
                                    stringRes.FromDatabaseExecute(drExecute);
                                    this.Invoke(new MethodInvoker(delegate { blStringResource.Add(stringRes); }));
                                    this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                                }
                            }
                            break;

                        case "SummonResource":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blSummonResource; }));
                            using (SqlDataReader drExecute = new SqlCommand(SummonResource.FromDatabase(), sqlcon).ExecuteReader())
                            {
                                while (drExecute.Read())
                                {
                                    SummonResource summonRes = new SummonResource();
                                    summonRes.FromDatabaseExecute(drExecute);
                                    this.Invoke(new MethodInvoker(delegate { blSummonResource.Add(summonRes); }));
                                    this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                                }
                            }
                            break;

                        case "SummonResource_82":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blSummonResource_82; }));
                            using (SqlDataReader drExecute = new SqlCommand(SummonResource_82.FromDatabase(), sqlcon).ExecuteReader())
                            {
                                while (drExecute.Read())
                                {
                                    SummonResource_82 summonRes82 = new SummonResource_82();
                                    summonRes82.FromDatabaseExecute(drExecute);
                                    this.Invoke(new MethodInvoker(delegate { blSummonResource_82.Add(summonRes82); }));
                                    this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                                }
                            }
                            break;

                        case "WorldLocation_73":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blWorldLocation73; }));
                            using (SqlDataReader drExecute = new SqlCommand(WorldLocation_73.FromDatabase(), sqlcon).ExecuteReader())
                            {
                                while (drExecute.Read())
                                {
                                    WorldLocation_73 worldRes73 = new WorldLocation_73();
                                    worldRes73.FromDatabaseExecute(drExecute);
                                    this.Invoke(new MethodInvoker(delegate { blWorldLocation73.Add(worldRes73); }));
                                    this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                                }
                            }
                            break;

                        case "WorldLocation":
                            this.Invoke(new MethodInvoker(delegate { dgv.DataSource = blWorldLocation; }));
                            using (SqlDataReader drExecute = new SqlCommand(WorldLocation.FromDatabase(), sqlcon).ExecuteReader())
                            {
                                while (drExecute.Read())
                                {
                                    WorldLocation worldRes = new WorldLocation();
                                    worldRes.FromDatabaseExecute(drExecute);
                                    this.Invoke(new MethodInvoker(delegate { blWorldLocation.Add(worldRes); }));
                                    this.Invoke(new MethodInvoker(delegate { if (progressBar1.Value != progressBar1.Maximum) { progressBar1.Value++; } }));
                                }
                            }
                            break;
                    }
                    sqlcon.Close();
                    sqlcon.Dispose();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }

        public void RDB_Search()
        {
            switch (cbSelect.Text)
            {
                case "StringResource":
                    try
                    {
                        for (int i = 0; i < dgv.RowCount; i++)
                        {
                            dgv.Rows[i].Selected = false;
                            if (dgv.Rows[i].Cells[2].Value.ToString() == search_box.Text)
                            {
                                dgv.FirstDisplayedScrollingRowIndex = i;
                                dgv.Rows[i].Selected = true;
                                break;
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    break;

                default:
                    try
                    {
                        for (int i = 0; i < dgv.RowCount; i++)
                        {
                            dgv.Rows[i].Selected = false;
                            if (dgv.Rows[i].Cells[0].Value.ToString() == search_box.Text)
                            {
                                dgv.FirstDisplayedScrollingRowIndex = i;
                                dgv.Rows[i].Selected = true;
                                break;
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    break;
            }
        }
    }
}
